Sign in to follow this  
Followers 0
Enforcer

DLL Call using Delphi Library

5 posts in this topic

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

Share this post


Link to post
Share on other sites



any help ? :) still need to solve this problem...


[RU] Zone

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
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
Sign in to follow this  
Followers 0