FFI (was: RE: [UPDATES] 30 new updates for 2.8alpha)

Bert Freudenberg bert at isgnw.CS.Uni-Magdeburg.De
Tue Feb 8 17:56:42 UTC 2000


On Sun, 6 Feb 2000, Raab, Andreas wrote:

> For those of you who want to play with this ...

Works like a charm on Linux:

"Say Hello in the console"
(ExternalLibraryFunction
	name: 'puts' module: nil callType: 0
	returnType: ExternalType long
	argumentTypes: {ExternalType string})
		invokeWith: 'Hello World!'

or, the problem of getting the local hostname:

| buf |
buf _ ByteArray new: 256.
(ExternalLibraryFunction
	name: 'gethostname' module: nil callType: 0
	returnType: ExternalType long
	argumentTypes: {ExternalType char asPointerType.
		ExternalType long})
	invokeWith: buf with: buf size.
(buf copyUpTo: 0) asString

This one seems to need a byte array - perhaps Strings may not be modified?

> I'll put out some more information on this soon.

Oh. I'll wait then ;-)

  -Bert-





More information about the Squeak-dev mailing list