|
-
May 25th, 2000, 08:00 PM
#1
My friend had written a DLL with C from which we are calling some functions in VB. The following is the code we're using but every time it gives us runtime errors - 'DLL Calling Convention Error'..
Can anyone enlighten us?
Code:
Global flagName As String
Public Declare Function getFlagState Lib "edrlib" (ByVal flagName As String) As Long
Private Sub Form_Load()
e = getFlagState(flagName) 'error here
End Sub
Even any little pointers?? Is the problem in our DLL - it may be to do with the string data type...
Cheers!
Mafro
[Edited by Mafro on 05-26-2000 at 10:27 AM]
-
May 25th, 2000, 10:20 PM
#2
Frenzied Member
it could well be with the string, passing it byval to C++ is right, when you get it in C++ you get a long pointer to a char array, is this what yu were expecting? If not change the dll.
-
May 26th, 2000, 12:35 AM
#3
Don't forget to initialise the string before passing it to the dll.
eg
flagName = space(255)
e = getFlagState(flagName)
-
May 30th, 2000, 03:35 PM
#4
The DLL has been tested in C with another program and works fine - my friend that wrote the DLL says he was expecting a long pointer to a char array.. This is the function prototype from the DLL:
int __declspec(dllexport) __cdecl getFlagState(LPSTR flagName);
Also, the flagName variable has a value when it is passed to the function, so we don't need to initialise it..
Would anyone mind having a look at the DLL and the program as it stands??
Thanks!!
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
|