Hello,
I have a subclass of NBExternalObject to refer to an external object (from the ICU library). When I'm done with the object I need to close it. The following instance method takes care of this:
<primitive: #primitiveNativeCall module: #NativeBoostPlugin>
self nbCall: #( void ucal_close( ICUCalendarNB self ) )
This works fine. But now I want to make use of the�NBExternalResourceManager so that external objects are closed automatically when they are no longer referenced. For this I have implemented the required instance method:
And the class methods:
finalizeResourceData: aHandle
Transcript show: 'Closing ', aHandle printString ; cr.
ifFalse: [ self primClose: aHandle ]
and
primClose: aHandle
<primitive: #primitiveNativeCall module: #NativeBoostPlugin>
^ self nbCall: #( void ucal_close( void* aHandle ) )
But now two things are going wrong:
- The #finalizeResourceData: doesn't seem to get called
- If I call the #primClose: directy with the handle as an argument my Image crashes.
Is the signature of the #nbCall: message wrong?
Jan.