Re: Noob, learning how to use dll's.
- Posted by Bernie Ryan <xotron at b?uefr?g.com> Jun 13, 2008
- 804 views
CChris wrote: > > Archarios wrote: > > > > }}} <eucode> > > without warning > > include file.e > > include dll.e > > include safe.e > > > > atom file1,DLL,GMSx,mem,result > > object temp > > file1 = open("D:\obscured\test.txt","w") > > > > DLL = open_dll("kernel.dll") > > GMSx = define_c_func(DLL,"GlobalMemoryStatusEx",{C_POINTER},C_INT) > > mem = allocate(64) > > result = c_func(GMSx,{mem}) ----faults here > > printf(file1,"%d",peek(mem+1)) > > free(mem) > > close(file1) > > abort(0) > > </eucode> {{{ > > I get: > > C:\EUPHORIA\include\safe.e:516 in function original_c_func() > > c_proc/c_func: bad routine number (-1) > > i = -1 > > s = {832176} > > > > ... called from C:\EUPHORIA\include\safe.e:522 in function c_func() > > i = -1 > > s = {832176} > > r = <no value> > > > > ... called from D:\obscured\test.exw:13 > > > > Do I have to use machine.e for this, I was using safe.e since I'm new to > > dll's. > > Are you sure you need the Ex ? CChris: Ex is correct. The structure being passed contains some DWORDLONG,s ( 64-bit int types ).
mem = allocate(64) << is WRONG
mem = allocate(512) << CORRECT VALUE
}}}
Bernie
My files in archive: WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API
Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan }}}