Let me preface by saying I know very little about C++. What I'm trying to do is access an API in VB, but only have a C++ example to go by. Confusing to say the least. So I'm attempting to recreate the API call, and need to define some new types to do so. Not as straight forward as I thought it would be.
Here's the original code I think is relevant:
And then what I think it would look like in VB6, without the type aliases:
This code takes down the IDE with an access violation when I attempt to call the function. From the little bit you see here, did I get the data types and so forth right?
Here's the original code I think is relevant:
Code:
typedef char COR_I1;//string?
typedef short COR_I2;//integer
typedef int COR_I4;//long
typedef unsigned char COR_U1;//string?
typedef unsigned short COR_U2;//integer
typedef unsigned int COR_U4;//long
typedef char COR_BOOLEAN;//string?
typedef COR_U1 PTM_DATA_TYPE; //string?
typedef COR_U2 PTM_DATA_LENGTH; //integer
typedef COR_U2 PTM_ELEMENTS; //integer
typedef struct ptm_data_rec
{
PTM_DATA_TYPE type;
PTM_DATA_LENGTH len;
PTM_ELEMENTS elem;
UCHAR fill[PTM_DATA_FILL];
COR_I1 value[PTM_MAXSIZE];
} PTM_DATA;
typedef struct ptmap_addr
{
RECORD_PTR ptr;
COR_I4 seq_num;
} PTMAP_ADDR;
typedef struct cor_status
{
COR_I4 status;
COR_I4 err_source;
COR_I4 err_code;
COR_I4 err_ref;
COR_BOOLEAN err_reported;
TCHAR err_msg[COR_STATUS_ERR_MSG_LEN];
TCHAR _fill[3];
} COR_STATUS;
And then what I think it would look like in VB6, without the type aliases:
Code:
Public Declare Function PTMAP_modify_setpoint Lib "ptmap.dll" (point_value As PTM_DATA, req_adr As PTMAP_ADDR, retstat As COR_STATUS) As Long
Public Type PTM_DATA
type As String
len As Integer
elem As Integer
fill As String
value As String
End Type
Public Type PTMAP_ADDR
ptr As String
seq_num As Long
End Type
Public Type COR_STATUS
status As Long
err_source As Long
err_code As Long
err_ref As Long
err_reported As String
err_msg As String
fill As String '** original member name has invalid character "_"
End Type
This code takes down the IDE with an access violation when I attempt to call the function. From the little bit you see here, did I get the data types and so forth right?