Hi,
Der Header sieht so aus:
//////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "tcpcli.h"
#ifdef TCPIPCLIENTDLL_EXPORTS
#define TCPIPCLIENT_API _declspec( dllexport )
#else
#define TCPIPCLIENT_API _declspec( dllimport )
#endif
#ifdef __cplusplus
extern "C" {
#endif
TCPIPCLIENT_API void __stdcall Initialize1( void (*ReplyOrEvent)(int Rep, const string& stName, const string& stVal, void* pOwner),
void* pOwner );
TCPIPCLIENT_API bool __stdcall Connect1( string stIPAddress = HOST, int nPort = PORTNUMBER);
TCPIPCLIENT_API bool __stdcall Connected1( );
TCPIPCLIENT_API void __stdcall Disconnect1( bool bWithUnAdvise = false );
TCPIPCLIENT_API bool __stdcall Request1( string& stItemName, e_ItemAttributes eIAtt = IAtt_None, string& stValue = stDummy );
TCPIPCLIENT_API bool __stdcall Poke1( string& stItemName, string& stValue, e_ItemAttributes eIAtt = IAtt_None );
TCPIPCLIENT_API bool __stdcall AdviseStart1( const string& stItemName, e_ItemAttributes eIAtt = IAtt_None, string& stValue = stDummy );
TCPIPCLIENT_API bool __stdcall AdviseStop1( const string& stItemName, e_ItemAttributes eIAtt = IAtt_None );
TCPIPCLIENT_API void __stdcall UnAdviseAll1( );
typedef void (__stdcall* INITIALIZE1)( void (*ReplyOrEvent)(int Rep, const string& stName, const string& stVal, void* pOwner), void* pOwner );
typedef bool (__stdcall* CONNECT1)( string stIPAddress, int nPort );
typedef bool (__stdcall* CONNECTED1)( );
typedef void (__stdcall* DISCONNECT1)( bool bWithUnAdvise );
typedef bool (__stdcall* REQUEST1)( string& stItemName, e_ItemAttributes eIAtt, string& stValue );
typedef bool (__stdcall* POKE1)( string& stItemName, string& stValue, e_ItemAttributes eIAtt );
typedef bool (__stdcall* ADVISESTART1)( const string& stItemName, e_ItemAttributes eIAtt, string& stValue );
typedef bool (__stdcall* ADVISESTOP1)( const string& stItemName, e_ItemAttributes eIAtt );
typedef void (__stdcall* UNADVISEALL1)( );
#ifdef __cplusplus
}
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////
Und das ist von HeadConv konvertierte
PAS Datei:
/////////////////////////////////////////////////////////////////////////////////////////////////////
{$INCLUDE "tcpcli.h"}
{$IFDEF TCPIPCLIENTDLL_EXPORTS}
const
TCPIPCLIENT_API = _declspec( dllexport );
{$ELSE}
const
TCPIPCLIENT_API = _declspec( dllimport );
{$ENDIF}
{$IFDEF __cplusplus}
{$ENDIF}
var
Initialize1: function(Rep: VOID (*REPLYOREVENT)(INT;
const stName: STRING&;
const stVal: STRING&;
pOwner): Pointer;
pOwner: Pointer) cdecl {$IFDEF
WIN32} stdcall {$ENDIF};
var
Connect1: function(HOST: STRING STIPADDRESS =;
PORTNUMBER: INT NPORT =): TCPIPCLIENT_API BOOL cdecl {$IFDEF
WIN32} stdcall {$ENDIF};
var
Connected1: function: TCPIPCLIENT_API BOOL cdecl {$IFDEF
WIN32} stdcall {$ENDIF};
var
Disconnect1: function(false: BOOL BWITHUNADVISE =) cdecl {$IFDEF
WIN32} stdcall {$ENDIF};
var
Request1: function(var stItemName: STRING;
IAtt_None: E_ITEMATTRIBUTES EIATT =;
var stDummy: STRING STVALUE =): TCPIPCLIENT_API BOOL cdecl {$IFDEF
WIN32} stdcall {$ENDIF};
var
Poke1: function(var stItemName: STRING;
var stValue: STRING;
IAtt_None: E_ITEMATTRIBUTES EIATT =): TCPIPCLIENT_API BOOL cdecl {$IFDEF
WIN32} stdcall {$ENDIF};
var
AdviseStart1: function(const stItemName: STRING&;
IAtt_None: E_ITEMATTRIBUTES EIATT =;
var stDummy: STRING STVALUE =): TCPIPCLIENT_API BOOL cdecl {$IFDEF
WIN32} stdcall {$ENDIF};
var
AdviseStop1: function(const stItemName: STRING&;
IAtt_None: E_ITEMATTRIBUTES EIATT =): TCPIPCLIENT_API BOOL cdecl {$IFDEF
WIN32} stdcall {$ENDIF};
var
UnAdviseAll1: function cdecl {$IFDEF
WIN32} stdcall {$ENDIF};
type
= VOID (__STDCALL* INITIALIZE1)( VOID (*REPLYOREVENT)(INT REP, CONST STRING& STNAME, CONST STRING& STVAL, VOID* POWNER), VOID* POWNER );
type
= BOOL (__STDCALL* CONNECT1)( STRING STIPADDRESS, INT NPORT );
type
= BOOL (__STDCALL* CONNECTED1)( );
type
= VOID (__STDCALL* DISCONNECT1)( BOOL BWITHUNADVISE );
type
= BOOL (__STDCALL* REQUEST1)( STRING& STITEMNAME, E_ITEMATTRIBUTES EIATT, STRING& STVALUE );
type
= BOOL (__STDCALL* POKE1)( STRING& STITEMNAME, STRING& STVALUE, E_ITEMATTRIBUTES EIATT );
type
= BOOL (__STDCALL* ADVISESTART1)( CONST STRING& STITEMNAME, E_ITEMATTRIBUTES EIATT, STRING& STVALUE );
type
= BOOL (__STDCALL* ADVISESTOP1)( CONST STRING& STITEMNAME, E_ITEMATTRIBUTES EIATT );
type
= VOID (__STDCALL* UNADVISEALL1)( );
{$IFDEF __cplusplus}
{$ENDIF}
var
DLLLoaded: Boolean { is
DLL (dynamically) loaded already? }
{$IFDEF
WIN32} = False; {$ENDIF}
implementation
var
SaveExit: pointer;
DLLHandle: THandle;
{$IFNDEF MSDOS}
ErrorMode: Integer;
{$ENDIF}
procedure NewExit; far;
begin
ExitProc := SaveExit;
FreeLibrary(DLLHandle)
end {NewExit};
procedure LoadDLL;
begin
if DLLLoaded then Exit;
{$IFNDEF MSDOS}
ErrorMode := SetErrorMode($8000{SEM_NoOpenFileErrorBox});
{$ENDIF}
DLLHandle := LoadLibrary('TCPIPCLIENT_DLL.DLL');
if DLLHandle >= 32 then
begin
DLLLoaded := True;
SaveExit := ExitProc;
ExitProc := @NewExit;
@Initialize1 := GetProcAddress(DLLHandle,'Initialize1');
{$IFDEF
WIN32}
Assert(@Initialize1 <> nil);
{$ENDIF}
@Connect1 := GetProcAddress(DLLHandle,'Connect1');
{$IFDEF
WIN32}
Assert(@Connect1 <> nil);
{$ENDIF}
@Connected1 := GetProcAddress(DLLHandle,'Connected1');
{$IFDEF
WIN32}
Assert(@Connected1 <> nil);
{$ENDIF}
@Disconnect1 := GetProcAddress(DLLHandle,'Disconnect1');
{$IFDEF
WIN32}
Assert(@Disconnect1 <> nil);
{$ENDIF}
@Request1 := GetProcAddress(DLLHandle,'Request1');
{$IFDEF
WIN32}
Assert(@Request1 <> nil);
{$ENDIF}
@Poke1 := GetProcAddress(DLLHandle,'Poke1');
{$IFDEF
WIN32}
Assert(@Poke1 <> nil);
{$ENDIF}
@AdviseStart1 := GetProcAddress(DLLHandle,'AdviseStart1');
{$IFDEF
WIN32}
Assert(@AdviseStart1 <> nil);
{$ENDIF}
@AdviseStop1 := GetProcAddress(DLLHandle,'AdviseStop1');
{$IFDEF
WIN32}
Assert(@AdviseStop1 <> nil);
{$ENDIF}
@UnAdviseAll1 := GetProcAddress(DLLHandle,'UnAdviseAll1');
{$IFDEF
WIN32}
Assert(@UnAdviseAll1 <> nil);
{$ENDIF}
end
else
begin
DLLLoaded := False;
{ Error: TCPIPCLIENT_DLL.DLL could not be loaded !! }
end;
{$IFNDEF MSDOS}
SetErrorMode(ErrorMode)
{$ENDIF}
end {LoadDLL};
begin
LoadDLL;
end.
///////////////////////////////////////////////////////////////////////////////////////////////////
Und z.B.
was soll ich mit
{$INCLUDE "tcpcli.h"}
machen ? Muss ich noch die tcpcli.h einbinden oder konvertieren ?
Deklaration von Initialize1
Initialize1: function(Rep: VOID (*REPLYOREVENT)(INT;
const stName: STRING&;
const stVal: STRING&;
pOwner): Pointer;
pOwner: Pointer) cdecl {$IFDEF
WIN32} stdcall {$ENDIF};
ist irgendwie falsch. Compiler meldet den Fehler.
Ich kriege das nicht hin.
Aber ich kann auch bezahlen wenn jemand das nicht aus Spass machen würde
schöne Grüße
Christoph Fröhlich