Jump to content

DLL Call using Delphi Library


 Share

Recommended Posts

Hi everybody, got a little problem...

Lets say i have Delphi library something like this:

library KPOT;

uses
  SysUtils,
  Dialogs,
  Classes;

{$R *.res}

function GO(hz: string): integer;
begin
ShowMessage('DLL CALLED !!!! YO-'+hz);
Result := 2;
end;

exports
   GO;

begin
end.

and got autoit3.au3 test script:

$lol = DllCall("KPOT.dll", "int", "GO","str","TEEEEEEEST FINE !!!")

But when I'm runing it - it returns Fatal Error - can't read memory at adress... What I'm doing wrong ? Please help.

[RU] Zone
Link to comment
Share on other sites

  • 2 weeks later...

hi Enforcer,

The problem might be memory management using strings in Delphi, here is an article with details.

The Solution?

Long story short, use Pchar or the likes to handle strings, here is with example Delphi Dll code and the corresponding AutoIt.

Hope this helps :)

-smartee

Link to comment
Share on other sites

Hi enforcer:

Please upload the test dll, so that I can test it.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

  • 1 year later...

library KPOT;

uses
  SysUtils,
  Dialogs,
  Classes;

// {$R *.res} ===== for delete

function GO(hz: string): integer;
begin
ShowMessage('DLL CALLED !!!! YO-'+hz);
Result := 2;
end;

exports
   GO;

begin
end.

:bye:

[center]I LOVE ALGERIA .... ;-)[/center]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...