help with FFI

mdc at keko.com.ar mdc at keko.com.ar
Mon Dec 15 14:04:38 UTC 2003


Hi to everybody
I need help to solve a problem with FFI, the thing 
is like 
this

+I've got a DLL that has a function whose prototype is:
 int WINAPI sio_read(int port, char *buf, int len)

I implemented a class in squed with this method
Moxalibrary>>

sioread: aPort buffer: aBuffer long: aInteger 

<apicall: short 'sio_read' (short void* short)>
^ self invalidCall.

In a transcript I do the following test: 

buffer :=String new: 100.
lib := Moxalibrary default.

lib sioread: 5 buffer: buffer long: 100.

the dll doesn't fail, because if it fails, it return  -1
the dll return 100 which are the 100 bytes that I ask it to read
and everything seems to work well, but the reading data are the problem 
because 
the same dll I've got in dolphin and the buffer charges with data that 
represents reading ascii, in squeak the buffer charges with data but 
the format 
seems to be wrong as if in squeak it wouldn't read in ascii, as if in 
squeak 
the format was a different one, but I don't get the same as in dolphin
I tried with several statements
<apicall: short 'sio_read' (short void* short)>
the trick is in void that corresponds to the inner buffer
If someone has a cue, manual or pdf or link that can read more than ffi 
in 
squeak I will appreciate it. Or any other way to do the same
thanks a lot
regards


-------------------------------------------------
¿Todavía no navegás con Keko?
Hacé click aquí: http://www.keko.com.ar



More information about the Squeak-dev mailing list