|
-
Mar 21st, 2000, 05:54 PM
#1
Thread Starter
Addicted Member
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.
-
Mar 21st, 2000, 06:23 PM
#2
Thread Starter
Addicted Member
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.
-
Mar 21st, 2000, 06:41 PM
#3
Thread Starter
Addicted Member
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.
-
Mar 21st, 2000, 07:15 PM
#4
Thread Starter
Addicted Member
Ok Fant,
I will relook at the dll, thanks for the help.
much appreciated.
Tony,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|