Re: Modifying the Euphoria interpreter
- Posted by CChris <christian.cuvier at agriculture.gouv.fr> Jun 12, 2007
- 537 views
Pete Lomax wrote: > > CChris wrote: > > No, it's even worse than that. > > Remember that, if ex.exe tries to compile a program which mentions > > open_dll(), it errors out even though the the function won't ever be > > executed because the call is protected by a "if platform()=??? then". > > The error is generated before the platform dependent code is removed. > > But replacing the call with "machine_func(50,"kernel32.dll") won't hurt. > > As well as the same things others have tried, I just tested this here: > }}} <eucode> > constant k32=open_dll("kernel32") > constant k32=machine_func(50,"kernel32") > </eucode> {{{ > Despite beginning to mistrust myself, I was right. Both the above fail equally > on ex.exe, since you cannot put a platform() check around either. > It is true, btw, to say that you cannot use constant definitions like the > above > in platform independent code. Instead you must use atom vars. > > The point I am trying to make here is that you seem to be locked into using > a direct call to machine_func when it will make no significant difference - > see the definition of open_dll() in dll.e. It is the machine_func call itself > which fails on ex.exe, NOT the trivial open_dll() wrapper... you can even > prove > this by putting a display inside open_dll just before the call to > machine_func: > it will show fine, just before ex.exe crashes. > > Regards, > Pete Of course I know the wrapper is trivial, and makes no difference. I thought I remembered that, if running a program using ex.exe, and if that program had lines like
atom k32 if platform()=WINDOWS then k32=open_dll("kernel32.dll") end if
I was getting an error for open_dll() not being supported under DOS. And then of course the wrapper would make a difference, since no one could object to a machine_func() call at compile time. But again, I'll have to check what actually happens. And as you said, the entry point can't be a constant, as it must appear inside an if block. CChris