RE: Euphoria as an extension language
- Posted by Matthew Lewis <matthewwalkerlewis at YAHOO.COM> Nov 18, 2002
- 411 views
> From: Rom [mailto:kjehas at frisurf.no] > From: "Ray Smith" <smithr at ix.net.au> > > > Can Euphoria call a function in a C++ or Delphi > application(exe-file)? > > > I am trying to figure it out and it seems to me it cannot be done. > > > > Basically No. I guess it would be possible "if" the exe you > wanted to call was an > > automation server (ie. like ms word or excel). Actually, I think it can. I've done this before using open_dll(), define_c_func(), etc. The problem with C++ is name decoration/overloaded/virtual functions. CDECL calling conventions can make things a little more difficult, but not impossible. > So what is the easiest way to create a scripting language > that can access important data/functions in a running application? David Cuny (with someone's help--don't have the file/name here right now) wrote an Eu emulator in Eu. I've converted this to use as a scripting language. I added some special hooks (get_data(), set_data(), etc) to change/read data that the script should have access to. It was very simple. I also removed all the low level stuff, like peek/poke > 1) Euphoria can call a function only if the function is > inside a DLL. It doesn't help because the DLL cannot call the > application. Untrue. We use callbacks all the time. > 3) LUA is especially constructed for this job (I decided I > would not use LUA because the interfacing isn't that easy (a > couple of days to figure it out?) and the application is not > in C++ either (so the C-code had to be wrapped up in an > ActiveX/VCL component... and the application becomes 0.5 MB heavier?). I still haven't really looked at Lua, but it's definitely possible if Lua comes in an ActiveX flavor. One of my long term goals has been to port Eu to ActiveX to allow it to be used as a scripting language in IIS. Matt Lewis