Re: passing a C function back to C library

Paolo Bonzini <[email protected]>
Newsgroups gmane.comp.lang.smalltalk.gnu.general
Message-ID <[email protected]>

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
   false
   st> (CFunctionDescriptor addressOf: 'aaa') isNull
   true

Paolo

>   Christoph
> 
> [0] https://www.gnu.org/software/smalltalk/manual/html_node/Smalltalk-callbacks.html
> 
> 
> 
> _______________________________________________
> help-smalltalk mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/help-smalltalk
>

_______________________________________________
help-smalltalk mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-smalltalk
signature.asc (application/pgp-signature, 473 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJYqq3fAAoJEL/70l94x66DtJcH/3AQO6GKov7dRzwulXGLMUW+
Yh6tZVG0ndlm2hmwvh+FkX8LwkOBEuhuNoYaqKFg+cVUCPQym7V0lzLLUqzU9Nrz
ubpMpts0O+D+ajQ0W/t/e/fHfFbjtW2zGwf9usAPLsR+be3vfMgazZJRBPluZyr/
Za7K7g0HSrptM9byB6088mYtIBeybAEcL0s4y8NdXfnDSIQQ7nsRBpH4o5+bz4c0
6rVTf9nS6mx2/M3uM4Gi0mta59AgITcOYm/4o3YD4wVkylGB0svMIigiwZN9B6MH
NaBiyYMNDAXQJnKCmvSD4YRc6wCOiCoMNn548uXjKzLmKZ9i+Zs/ssmxMtHOZ4k=
=sYuI
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.