I'm writing a DLL in C++ for VB. If i'm passing a string to a C Function, would I use char[255] or some character
array large enough to hold the string? Do I need any other
arguments.
Printable View
I'm writing a DLL in C++ for VB. If i'm passing a string to a C Function, would I use char[255] or some character
array large enough to hold the string? Do I need any other
arguments.
No - you'd pass a pointer:
And the VB prototype:Code:void func(char *pcString) {
...
}
Code:Declare Sub func Lib "whatever" (ByVal pcString As String)
Thanks for the help!
Parksie (or anyone else for that matter)
I'm trying to get the C function to return a char back as well.
adding on to the above mentioned code, how do i get the
c func to return a char or string and also hvae the vb func
accept it?
To do that, you pass a pointer to a buffer (using char* / ByVal x as String), and a length.
I did an example on this for someone a while back, and here it is: http://www.parksie.net/StringDLL.zip
Thank you once again, i will try it