Re: Rob: Q: Constant Scope
- Posted by Vincent <darkvincentdude at yahoo.com> Apr 24, 2005
- 533 views
Juergen Luethje wrote: > > Matt Lewis wrote: > > > Juergen Luethje wrote: > >> > >> I translated the most simple sample DLL that I could think of, using > >> the official Eu 2.5 translator (compiled with Borland and Watcom) on > >> Windows 98: > >> > >> ------------[ file mydll.ew ]------------ > >> }}} <eucode> > >> global integer foo > >> foo = 123 > >> </eucode> {{{ > >> ----------------------------------------- > > <snip> > > > You need to change the declaration for foo. In main_.h, you should see > > > > extern int _1foo; > > > > Change this to: > > > > extern _declspec(dllexport) _1foo; > > > > Now you should be able to: > > }}} <eucode> > > lpFoo = define_c_var(lpLib, "__1foo") > > </eucode> {{{ > > Note that bcc adds an extra underscore. I don't think bcc allows you to > > put variables into the def file, so you seem to be stuck with the ugly > > name. I haven't tried with any other compilers. > > That works fine, thank you! > Well, the ugly name isn't a big issue for me, since it's only used once > in the define_c_var() function. > > Now I know the reason for my previous confusion. I had assumed that the > translator automatically exports global variables from a DLL. Now I've read > the docs and saw, that this obviously isn't the case. > > Thanks, > Juergen > > Awesome dude thanks :D Regards, Vincent -- Without walls and fences, there is no need for Windows and Gates.