Call a DLL function using a BSTR parameter

  • Thread starter Thread starter Romain TAILLANDIER
  • Start date Start date
R

Romain TAILLANDIER

Hi group

i have a dll named JettRfid.dll on my Windows CE .net 4.2 device.

in that dll i have a few fonction that i have to call

bool ReadTagID (/*out*/ BSTR bsTagID, /*in*/ int iBytes, /*out*/
RFID_TAGTYPE rtTagType, /*out*/ int iErrorCode);

In full framework i use the Marshalas attribute to convert the BSTR to a
string and vice versa.
but how do you doing it in compact framework ?
generally how do Marshalling and interop work in CF (need some links :) )


thank for your help
ROM
www.maintag.com
 
BSTR is a Unicode string with the counter preceding a string and allocated
by COM (CoTaskMemAlloc called from inside SysAllocString) rather than by C
runtime or heap allocator. It means that you pass a String parameter to such
function. Now, the problem with your function is that it has several
parameters that are marked /*out*/, but are not references (pointers). Are
you sure you got the function definition right?
 
Back
Top