Hello,

tl;dr: what's the reason to get aNBExternalHandle even if you expect a MySuperHandle object from an nbCall?

I am trying to build my first DLL wrapper with NativeBoost. I am having a problem that instead of returning a handle object (as I thought), my "primitive" throws NBExternalHandles at me.

The API I am trying to wrap tries to be somewhat object oriented by (mostly) having a handle of some sort.

My thinking was to attach all DLL primitives to the respective Handle Objects they take as a first parameter and go from there.

Some workspace code:

"Supplementary DLLs"
Tm1ULibDllLibraryLoader loadLibrary.
LibIbmCogEayLibraryLoader loadLibrary.
SslIbmCogEayLibraryLoader loadLibrary.
Log4CxxLibraryLoader loadLibrary.
"DLL to wrap"
TM1LibraryLoader loadTM1Library.

t := TM1Api new.
t tm1APIInitialize.
hUser := t tm1SystemOpen. "Returns a proper 'TM1UHandle' object'"
hUser tm1SystemAdminHostSet: 'localhost'.
hPool1 := hUser tm1ValPoolCreate. "Returns NBExternalHandle"
hPool1 inspect.
hUser tm1SystemClose.
t tm1APIFinalize.

TM1Api>>#tm1SystemOpen
    <primitive: #primitiveNativeCall
     module: #NativeBoostPlugin>
    ^ self nbCall: #(TM1UHandle TM1SystemOpen(void))

TM1UHandle>>#tm1ValPoolCreate
    <primitive: #primitiveNativeCall
     module: #NativeBoostPlugin>
    ^ self nbCall: #(#TM1PHandle TM1ValPoolCreate ( TM1UHandle self ) )

Both, TM1UHandle class and TM1PHandle class have the method
asNBExternalType: gen
    "use handle ivar to hold my instance (TM1x)"
    ^ NBExternalObjectType objectClass: self

and are subclasses of object. What's my mistake? Can you tell with the information I provided?

Best regards,
  Markus

Reply via email to