Writing DLL in Delphi, passing strings

Got a problem you cannot solve? Try here.
Post Reply
anders_g
Posts: 1
Joined: Tue Oct 05, 2010 7:01 am

Writing DLL in Delphi, passing strings

Post by anders_g »

Hi,
this procedure

procedure MyStringFunction(var AString: PAnsiChar); stdcall;
begin
AString := 'some string';
end;

exported in a DLL, works with Installaware "Call DLL" - BUT! the word "some string" is not returned - just garbage. What am I doing wrong?

/Anders
mills
Posts: 814
Joined: Tue Jul 06, 2010 7:10 pm
Location: Honolulu, HI

Re: Writing DLL in Delphi, passing strings

Post by mills »

I haven't touched Delphi yet myself, but what if you call that procedure from within a Delphi app to test it?

From the looks of it, you'll want to use a function, not a procedure.
http://www.delphibasics.co.uk/Article.asp?Name=Routines

Hopefully that gets you pointed in the right direction.
Andy Mills
InstallAware
Other Help:
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Product Guides - http://www.installaware.com/publication ... guides.htm
InstallAware Help - Press F1 in the InstallAware IDE.
Post Reply