🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #13574

Re: Using Delphi Dll in BCB application

#13574
From: Seabass
Date: Sat, 04 Oct 2003 22:27
44 lines
2380 bytes
thank you for your reply!
the reason I have it setup like this, is because I assign the pointers like
this:

Tempuser = new TUser();
Tempuser->pChat = &TUser::SendChat;
Tempuser->pData =  &TUser::SendData;
Tempuser->pdisconnect = &TUser::Disconnect;
Tempuser->pkick = &TUser::Kick;
Tempuser->pPass  = &TUser::ChangePass;
Tempuser->pPM  = &TUser::SendPM;

I change the Delphi code like you suggested:
type
  TSendMess = procedure (sb1:pchar;sb2:pchar) of object;safecall;
  TCommon = procedure()of object;stdcall;
  TCommon2 = procedure (sb1:pchar) of object;stdcall;
  TCommon3 = function (sb1:pchar):boolean of object;stdcall;

The parameters are now fine, which makes me think that there is still hope
for me ;) Another problem has occurred though. When I call the pChat
function from the DLL, the 'this' pointer in the C++ function pChar is
pointing is equal to NULL, but when I check the object on the DLL side,
everything seems fine.

//Delphi Side
  type PUser = ^TUser;
function Connect(User: PUser): integer;stdcall;
begin
User^.pChat('Test','123');
result = true;
end;
//C++ side
void __stdcall TUser::SendChat(const char* sFrom,const char* sMessage)
{
this->Socket->Send("<" + AnsiString(sFrom) + "> " + AnsiString(sMessage) +
"|");
}

Any thoughts?

thank you =)

Seabass
Technical Details
Message-ID: <3f7f4929$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!sn-xit-03!sn-xit-01!sn-xit-05!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!yellow.newsread.com!netaxs.com!newsread.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f7f2049@newsgroups.borland.com> <3f7f3ed0$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,c7642e4ad15381e3
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-10-04 15:45:33 PST
From: "Seabass" <sbsoftea@ww-ei.nl>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f7f2049@newsgroups.borland.com> <3f7f3ed0$1@newsgroups.borland.com>
Subject: Re: Using Delphi Dll in BCB application
Date: Sun, 5 Oct 2003 00:27:49 +0200
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 80.145.189.3
Message-ID: <3f7f4929$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1065306409 80.145.189.3 (4 Oct 2003 15:26:49 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!sn-xit-03!sn-xit-01!sn-xit-05!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!yellow.newsread.com!netaxs.com!newsread.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail