PDA

Click to See Complete Forum and Search --> : returning c structure to a VB application


Crazy D
Aug 10th, 2000, 02:17 AM
I think you can pass it ByRef as an argument.

rothba
Aug 10th, 2000, 06:42 AM
I'm not trying to pass the structure to the dll. I'm try to return the structure from the DLL to VB. I declare the c++ function in the DLL to have a return value of CODES * (which is a pointer to my c++ structure). In VB I declare the return value as CODES (which is a UDT with the same varibles defined as the c++ structure). However, when I use the variables they have bogus information. Code is as follows:

C++

typedef struct CODES
{

int sH;
int rC;

} CODES;


CODES * _stdcall fnCpp(char * dbF, int aM, char * sN, int cT, char * aN)

VB declaration

Public Type CODES

intSH As Integer
intRC As Integer

End Type

Public Declare Function fnCpp Lib "C:\cpp\cppfile.dll" _
(ByRef strDb As String, ByVal intAM As Integer, _
ByRef strSN As String, ByVal intCT As Integer, _
ByRef strAN As String) As CODES