Click to See Complete Forum and Search --> : c++ dll returning string


Muk108
10-04-2004, 07:00 PM
i have no idea how to return a string from my dll here is some code i have so far

main.cpp

char *__stdcall myfunction(char * variable)
{
return variable;
}


main.def


EXPORTS
myfunction


vb code


Private Declare Function myfunction Lib "my.dll" (ByVal variable As String) As String
-----
MsgBox myfunction("test")


whats wrong i get a message saying it cant read the memory and also one that says it cant write to the memory... thanks for the help.

Muk108
10-04-2004, 08:01 PM
nm that works, but when i try to do a strcpy it crashes the dll and says it wont work? does anyone have an idea for that?