Hi,

I have a C DLL routine which looks like this:

const char* C_routine(const char* msg, int length, const char* msg2);




How to call this routine from VB?
here is what i have done

Private Declare Function MyC Lib "test.dll" (ByVal msg As String, ByVal length As Integer, ByVal msg2 As String) As String

Private Sub Class_Initialize()
Dim test As String

test$ = C_routine("message", 7, "msg2") '//error message at this line!! Bad DLL calling convention

End Sub



The C_routine is executed as it supposed to, but at the end of execution, i got an error message saying "Bad DLL calling convention"!! what have i done wrong? Pls help.. Does the C_routine need to modify the parameters type in order to match VB type? if so, how??