<div class="gmail_quote"><div>Thanks for the reply, Mariano! I tried your advice but I ended up with some "Could not coerce arguments" errors and crashing the VM several times :P. </div><div>However, I tried something like this:</div>
<div><br></div><div>IplImage>>free</div><div>SqueakCV apiReleaseImage: handle asByteArrayPointer.<br></div><div><br></div><div><div>SqueakCV>>apiReleaseImage: doublePointer </div><div><span class="Apple-tab-span" style="white-space:pre">        </span><apicall: void 'cvReleaseImage' (byte*) module: 'cxcore110.dll'></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>^ self externalCallFailed</div></div><div><br></div><div><br></div><div>It appears to be working. I don't know if this is the right way to do it, though. I don't know either if overriding #free is ok and it would not bring problems later...</div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><span class="Apple-style-span" style="font-family: Arial; font-size: 16px; -webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; "><pre style="font-family: monospace; margin-left: 3em; font-size: 90%; ">
><i> 2) To finalize objects the OpenCV library defines some functions such
</i>><i> as cvReleaseImage, cvReleaseMat, etc. As far as I can tell, these functions
</i>><i> receive a pointer-to-pointer as argument. How can I declare such a method in
</i>><i> Squeak? Having one object, how can I get the pointer to that object? Should
</i>><i> I use the #getHandle method?
</i>><i>
</i>
In OpenDBX we have a functions like this for example:
long odbx_init(odbx_t**, char*, char*, char*)
This is how I declare it:
apiInitialize: handle backend: backend host: host port: port
<cdecl: long 'odbx_init' (ulong* char* char* char*) module: 'opendbx'>
^self externalCallFailed
Remember a pinter to a pointer is a long :)
And then in the code I do something like this:
handleArray := WordArray with: 0.
err := OpenDBX current
apiInitialize: handleArray
backend: self backend
host: aConnection settings host
port: aConnection settings port.
Notice the WordArray.
I have no idea of 1) and 3) sorry.
I hope this helps. If this do help, perhaps we can put it in FFI wiki page.
Cheers,
Mariano</pre></span></blockquote></div><br>