RE: COM ON!!! ... OLE!!! AYE CARRAMBA!!
- Posted by Matthew Lewis <matthewwalkerlewis at YAHOO.COM> Mar 19, 2001
- 509 views
> -----Original Message----- > From: Mike The Spike [mailto:mtsreborn at yahoo.com] > > I don't know too much about COM, but I don't see why > > Eu can't, unless it's > > because COM is C++ based, rather than C. There > > should be no real reason why > > Eu couldn't link up with anything with a C-based > > API. You just have to > > figure out the API. > > Err.... > no... > COM/OLE/ActiveX in Euphoria? > No way pal, no can do... > That's impossible... > If I can't do it, probably no one can... Well, I don't know about that. But first, let me ask you, have you used COM in any other language? I pulled down the COM specs: and took a look at them. It's certainly not _easy_, but I doubt it's impossible. There are a few hurdles to be overcome, of course. I haven't gotten my hands on any COM object with the docs for it (to get the GUID's, interface details, etc), but that would be the first step, I think. The only real hurdle would be figuring out how to call the interfaces. Building the pointer table would be easy. (To explain, to call the functions in a COM object, you have to build a virtual function pointer table, which turns out to be what C++ does for object methods. But it's a binary standard, so any language that supports calling functions by pointer can theoretically interface with COM.) In theory, you could use call() to call the interfaces, but that wouldn't handle the arguments. It should be fairly easy for someone to write a little ASM routine that pushed the arguments on the stack and called the routine, right? I don't really know ASM, so that probably won't be me any time too soon, but here's how I suspect it would work. You could have a memory location that holds a pointer to the arguments in memory, and another that tells you how many there are. The ASM looks at that and pushes them on the stack. Then there's also a pointer stored in memory that tells the ASM where to jmp to. Depending on the calling convention (stdcall/cdecl--COM defaults to stdcall, but it's legal to have cdecl routines), you might also need to clean the stack. Then in Eu you write the code to wrap that stuff, and an app calls those routines. After that, it's all figuring out the COM API, which you'd pretty much have to do with any other language interfacing with COM. How far did you get? Can you post what you did? Maybe we can figure out how to wrap COM so it's easy to use with Eu. Matt Lewis