[squeak-dev] FFI calls to functions that expect pointers to write results into

tim Rowledge tim at rowledge.org
Wed Feb 4 22:10:29 UTC 2015


I haven’t been able to uncover *any* decent doc for FFI calls, so any pointers would be nice.

In particular, given a C function def
void piBoardId (int *model, int *rev, int *mem, int *maker, int *overVolted)
What on earth do I do ?

	#<cdecl: void 'piBoardId' (long * long * long * long* long* ) module: 'wiringPi’>
seems to be the basic incantation but so far I see nothing that might explain to me what would make it actually work.

Really basic stuff like 
piBoardRev
"Read the revision code of the Pi. ."
"ScratchWiringPiInterface new piBoardRev"
	#<cdecl: long 'piBoardRev' (void ) module: 'wiringPi'>
	^self externalCallFailed

seems fine, as does
digitalRead: pin
"Read the value of a given Pin, returning HIGH or LOW"
"ScratchWiringPiInterface new digitalRead: 1"
	#<cdecl: long 'digitalRead' (long ) module: 'wiringPi'>
	^self externalCallFailed

What has my assorted googling missed?

tim
--
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Useful random insult:- Wasn't fully debugged before being released.




More information about the Squeak-dev mailing list