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

Reply via email to