[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] passing a C function back to C library

From: Paolo Bonzini
Subject: Re: [Help-smalltalk] passing a C function back to C library
Date: Mon, 20 Feb 2017 09:50:36 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0

On 19/02/2017 17:32, Christoph Egger wrote:
> Hi!
> [0] discusses how to pass a callback to some C library. Now I would like
> to pass a function from some C library to some C library. Is there a
> better way to express this than using <cCall ...> to get a smalltalk
> function and CCallbackDescriptor to pass it back?

You can get the address of a C function with something like

   CFunctionDescriptor addressOf: 'unlink'

If the function is not defined, the returned object will satisfy #isNull:

   st> (CFunctionDescriptor addressOf: 'unlink') isNull
   st> (CFunctionDescriptor addressOf: 'aaa') isNull


>   Christoph
> [0] 
> _______________________________________________
> help-smalltalk mailing list
> address@hidden

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]