Page 1 of 1

Writing DLL in Delphi, passing strings

Posted: Tue Oct 05, 2010 7:05 am
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

Re: Writing DLL in Delphi, passing strings

Posted: Tue Oct 05, 2010 4:00 pm
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.