-
Hello,
I have an issue calling a dll written in C. The function I require expects a string parameter and passes another string back:
char * Plc_genpass(char *);
however when I call the function from VB it crashes my application:
Declare Function Plc_genpass Lib "u4ntpgen.dll" ( _
ByVal ls_string As String) As String
Can anyone point me in the right direction?
Thnaks
Tony.
-
Thanks FantCool,
I had the C code modified, and set the function prototype in VB to your suggestion. This again caused a crash.
I then initialised the return string to 60 spaces in case C had an issue with an uninitialised string. Same result, crash.
I am presuming the return string is contained in ret_string, and this will be found at the address located by the returned long, is this right?
Thanks again.
Tony.
-
Fant,
it returns an error reading a particular address then allows me to stat VC++ to debug. The information presented in VC++ is meaningless to me.
Your function prototype returning the long, can you explain why this was not set up as a sub, since ret_string's address would be known to VB. i.e.
Declare sub Plc_genpass Lib "u4ntpgen.dll" ( _
ByVal ls_string As String, ByRef ls_result As String)
Thanks
Tony.
-
Ok Fant,
I will relook at the dll, thanks for the help.
much appreciated.
Tony,