DLL requires a char....
Posted on 2004-03-24
OK, I have a dll written in VC++5.0 which as one of the parameter requires a char reference which is expected to have been already allocated by the calling function.
the function declaration looks like this
Declare Auto Function cspGetBarcode Lib "csp32.DLL" (ByRef stBarData As Char(), ByVal lgBarcodeNumber As Long, ByVal maxLength As Long) As Int16
and the call like this:
Dim strCode As String = New String(" ", 10)
code = cspGetBarcode(strCode, i, codeLength)
obviously the reference is not being passed as I expected as I end up with a string exactly the same as it was before the call.
I know that the marshaller has something to do with this and have tried using a stringBuiler object. I can't seem to get that to work either.
Any ideas ..?
this must be a fairly common problem.