Delphi >> DLL >> C++
:cry:
Hi, I have a problem using a dll written i C++ invoking from Delphi6. How to pass pointers (type struct) to a dll ? C++ function:
Code:
-------------------------------
typedef struct
{ unsigned int lengt; unsigned char data[2096]; }MESSAGE_; extern "C" __declspec(dllexport) unsigned char WINAPI build_esco_format (MESSAGE_ *pntr, unsigned char comm_type, unsigned long source, unsigned long destination) Delphi function:
Delphi-Quellcode:
[edit=sakura] Code-Tags corrected ;-) Mfg, sakura[/edit]
TYPE pMESSAGE = ^TMESSAGE_;
TMESSAGE_ = record lengt: Word; data: Array[0..2096-1] of Char; end {MESSAGE}; var Message_2 : pMESSAGE; function build_esco_format (Message_2 : pMESSAGE; comm_type : Byte; source : LongInt; destinatin: LongInt ): Byte; stdcall; external thedll; |
Re: Delphi >> DLL >> C++
Simply use the @ operator:
Delphi-Quellcode:
var
AMessage : TMESSAGE_; Acomm_type : Byte; Asource : LongInt; Adestination: LongInt; ARes :Byte; begin //... ARes := build_esco_format(@AMessage, Acomm_type, Asource, Adestination); |
Re: Delphi >> DLL >> C++
Delphi-Quellcode:
TYPE
pMESSAGE = ^TMESSAGE_; TMESSAGE_ = packed record length: Integer; data: Array[0..2096-1] of Char; end {MESSAGE}; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 04:51 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz