Re: C array pointers
- Posted by petelomax Jul 12, 2018
- 1744 views
I found that bgi.zip.
I couldn't find anything wrong!
This works perfectly, for me, on both 32 and 64 bit (draws something that vaguely resembles a v-shaped-diamond-stone):
atom bgiDll = 0 integer _drawpoly, _openbgi procedure init() ifdef BITS32 then bgiDll = open_dll("bgi32.dll") elsedef bgiDll = open_dll("bgi64.dll") end ifdef _openbgi = define_c_proc(bgiDll,"bgi_openbgi",{C_INT, C_INT,C_INT, C_INT, C_POINTER}) c_proc(_openbgi,{800, 800, -1,-1, "test"}) _drawpoly = define_c_proc(bgiDll,"bgi_drawpoly",{C_INT, C_POINTER}) end procedure init() sequence poly = {100,100,200,300,100,150,200,100,400,100,200,300,380,150,100,100} integer len = 4 integer plen = length(poly) atom pPoly = allocate(len*plen, true) poke4(pPoly,poly) c_proc(_drawpoly,{plen, pPoly}) sleep(5)
Pete
PS I cut it down to something small enough to run through OllyDbg/FDBG, and can confirm that both the 32 and 64 bit dlls are indeed loading 32-bit values.