Thanks for sharing the solution mate :) I don't know if you are aware, but you can also ask questions on Pharo's discord. Though it's easier to go through the history of conversations by email. Cheers, Harald Le mar. 7 déc. 2021 à 04:53, <tomazz.turk@gmail.com> a écrit :
Found the solution! Here it is, if somebody needs the description.
The webview_bind() function in DLL that expects to get a pointer to the function in Pharo can be called like this:
WebViewLibrary >> bind: webview name: aString callback: aFFICallback arguments: aByteString
^ self ffiCall: #(void webview_bind(void * webview, const char * aString, FFICallback aFFICallback, void * aByteString))
Before doing the actual call, the callback should be made according to fn signature:
doIt := FFICallback
signature: #( void (const char *seq, const char *req, void * arg) )
block: [ :seq :req :arg |
âdo the stuffâ
].
And the call is then made as:
WebViewLibrary new bind: webview name: 'newJsFunctionName' callback: doIt arguments: args.
The next challenge is, of course, threading ...
Best wishes, Tomaz