Yes, I've already read that somewhere, but the problem is I can't modify the DLL... Thanks anyway.
Swim 13nrv
Posts
-
Sending and catching strings from a DLL -
Sending and catching strings from a DLLThanks for your help. Although I'm now using a StringBuilder, the parameter doesn't seem to get in the DLL... I really wonder why this doesn't work :(
-
Sending and catching strings from a DLLHello, I have difficulties in using a DLL I was given. So I can't modify the code of this DLL, but I know that it works, since I tested it succesfully with a C program (with the .h and .lib files that were given with it). My problem is I have to call it in VB .NET. Here is the function that I have to call in the DLL:
void myfunction( long * param_one, long param_two, unsigned char * param_three, unsigned char * param_four)
Parameters 1 and 4 are outputs and parameters 2 and 3 are inputs. And here is how I declare and call it in my VB Code:Private Declare Sub myfunction Lib "mydll" _ (ByRef param_one As Long, _ ByVal param_two As Long, _ ByVal param_three As String, _ ByVal param_four As String)
Call myfunction(a,b,c,d)
It seems the string input (param_three) doesn't reach the DLL, which I know from the return code (param_one). I've tested with ByRefs for the strings but it doesn't work either. Maybe is it a problem with the fact that these are unsigned char * ? I am a brand new DLL user so I may have made mistakes... If someone has an idea, I would really appreciate it.