Collegare una DLL con C Struttura
Posted: Tue Mar 21, 2017 4:11 pm
Salve,
Dovrei tradurre un sorgente scritto in C collegandomi ad una DLL in xHarbour e FWH 9.05. Ho usato la classe tStruct (non so se nel corso del tempo ha subito cambiamenti),
ma il risultato è che non riesco a collegarmi al device. Qualcuno mi saprebbe indicare la soluzione
Grazie
typedef struct
{
char IPAddress[16]; //xxx.xxx.xxx.xxx
int Port;
} TETHParameters;
typedef struct
{
char Amount[8+1];
char ECRId[8+1];
char PaymentType[1+1];
char TerminalId[8+1];
} TECRData;
typedef struct
{
char TerminalId[8+1];
char AcquirerId[11+1];
char TransactionType[3+1];
char TransactionResult[2+1];
} TPOSData;
TETHParameters ETHParameters;
strcpy(ETHParameters.IPAddress, “192.168.1.2”);
ETHParameters.Port = 1234;
IAE17AX_InitEth(ÐParameters);
TECRData ECRData;
TPOSData POSData;
int TransactionResult;
strcpy(ECRData.Amount, “00000001”);
strcpy(ECRData.PaymentType, “0”);
strcpy(ECRData.ECRId, “12345678”);
strcpy(ECRData.TerminalId, “87654321”);
TransactionResult = IAE17AX_Payment(&ECRData, &POSData);
ECRData e POSData sono puntatori alle strutture
------------------------------------------
STRUCT TETHParameters
MEMBER IPAddress As STRING LEN 16
MEMBER Port As _INT
ENDSTRUCT
ETHParameters:=ThisStruct(TETHParameters)
ECRData:=ThisStruct(TECRData)
POSData:=ThisStruct(TPOSData)
ETHParameters:IPAddress:="192.168.1.2"
ETHParameters:Port:=1234
IAE17AX_InitEth(@ETHParameters)
STRUCT TECRData
MEMBER Amount As STRING LEN 8+1
MEMBER ECRId As STRING LEN 8+1
MEMBER PaymentType As STRING LEN 1+1
MEMBER TerminalId As STRING LEN 8+1
ENDSTRUCT
STRUCT TPOSData
MEMBER TerminalId As STRING LEN 8+1
MEMBER AcquirerId As STRING LEN 11+1
MEMBER TransactionType As STRING LEN 3+1
MEMBER TransactionResult As STRING LEN 2+1
ENDSTRUCT
ECRData:Amount:="00000001"+chr(0)
ECRData:PaymentType:="0"+chr(0)
ECRData:ECRId:="12345678"+chr(0)
ECRData:TerminalId:="87654321"+chr(0)
TransactionR:=IAE17AX_Payment(@ECRData,@POSData)
DLL32 FUNCTION IAE17AX_InitEth(@ETHParameters AS PTR) AS VOID PASCAL LIB "IAE17.DLL"
DLL32 FUNCTION IAE17AX_Payment(@ECRData AS PTR, @POSData AS PTR) AS _INT PASCAL LIB "IAE17.DLL"
Dovrei tradurre un sorgente scritto in C collegandomi ad una DLL in xHarbour e FWH 9.05. Ho usato la classe tStruct (non so se nel corso del tempo ha subito cambiamenti),
ma il risultato è che non riesco a collegarmi al device. Qualcuno mi saprebbe indicare la soluzione
Grazie
typedef struct
{
char IPAddress[16]; //xxx.xxx.xxx.xxx
int Port;
} TETHParameters;
typedef struct
{
char Amount[8+1];
char ECRId[8+1];
char PaymentType[1+1];
char TerminalId[8+1];
} TECRData;
typedef struct
{
char TerminalId[8+1];
char AcquirerId[11+1];
char TransactionType[3+1];
char TransactionResult[2+1];
} TPOSData;
TETHParameters ETHParameters;
strcpy(ETHParameters.IPAddress, “192.168.1.2”);
ETHParameters.Port = 1234;
IAE17AX_InitEth(ÐParameters);
TECRData ECRData;
TPOSData POSData;
int TransactionResult;
strcpy(ECRData.Amount, “00000001”);
strcpy(ECRData.PaymentType, “0”);
strcpy(ECRData.ECRId, “12345678”);
strcpy(ECRData.TerminalId, “87654321”);
TransactionResult = IAE17AX_Payment(&ECRData, &POSData);
ECRData e POSData sono puntatori alle strutture
------------------------------------------
STRUCT TETHParameters
MEMBER IPAddress As STRING LEN 16
MEMBER Port As _INT
ENDSTRUCT
ETHParameters:=ThisStruct(TETHParameters)
ECRData:=ThisStruct(TECRData)
POSData:=ThisStruct(TPOSData)
ETHParameters:IPAddress:="192.168.1.2"
ETHParameters:Port:=1234
IAE17AX_InitEth(@ETHParameters)
STRUCT TECRData
MEMBER Amount As STRING LEN 8+1
MEMBER ECRId As STRING LEN 8+1
MEMBER PaymentType As STRING LEN 1+1
MEMBER TerminalId As STRING LEN 8+1
ENDSTRUCT
STRUCT TPOSData
MEMBER TerminalId As STRING LEN 8+1
MEMBER AcquirerId As STRING LEN 11+1
MEMBER TransactionType As STRING LEN 3+1
MEMBER TransactionResult As STRING LEN 2+1
ENDSTRUCT
ECRData:Amount:="00000001"+chr(0)
ECRData:PaymentType:="0"+chr(0)
ECRData:ECRId:="12345678"+chr(0)
ECRData:TerminalId:="87654321"+chr(0)
TransactionR:=IAE17AX_Payment(@ECRData,@POSData)
DLL32 FUNCTION IAE17AX_InitEth(@ETHParameters AS PTR) AS VOID PASCAL LIB "IAE17.DLL"
DLL32 FUNCTION IAE17AX_Payment(@ECRData AS PTR, @POSData AS PTR) AS _INT PASCAL LIB "IAE17.DLL"