Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passig types from delphi to DLL

Status
Not open for further replies.

Nordlund

Programmer
Jul 17, 2001
458
SE
Hi there.
I think DLL is a djungle of PChars and pointers ^ and more... But.... I have to use them... :)

How do I pass Types from Delphi to a DLL av vice versa.

Im going to make a setup which require a serial key validation.
Therefore, the Delphi app has to send a Key (in string format, more than 255 chars) to the dll, and the dll is decoding/extracting the key and then return several things to the Delphi app.

This is the DLL procedure header (But does it work?):
Code:
procedure DecodeKeyNew(Key: PChar; var resultKey: TKey); stdcall;

the resultKey is a Delphi ordinary record:
Code:
  TKey = record
    Key: PChar;
    KeyLen: Integer;

    HexKey: PChar;
    HexKeyLen: Integer;
  end;

(I'm unable to use the Borland .dll file BORLNDMM.DLL due to other restrictions)


Am I on the right track, or am I lost in space here :)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"There is always another way to solve it, but I prefer my way.
 
Have you attempted it? I assume so or you wouldn't be asking? If I were to guess at this, I would say you'd have to make your result a pointer as well.
 
Yep. I have tried anything... (Or at least neraly everything)...

I'm starting to believe the problem is Slphi 2005.... I just installed it, and i get a bunch of weird error messages all the time.

I have used Delphi 7, 5, 3 för at while, but never experienced the same amount of weird messages at all.
Maybe it's Delphi 2005 bugs, but this would be a dumb excuse of bad programming... But i cant stop thinkng.....




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"There is always another way to solve it, but I prefer my way.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top