Returning strings from DLLs written in Delphi

Trevor Keon tkeon0 at netscape.net
Thu Mar 7 20:31:26 EST 2002


Hi,

I have been trying to get a DLL written in Delphi 5 to return a string
to Python 2.1.2 (i use windll to access the dll), and all I get is a
bunch of numbers(the numbers stay the same too).  I also had this
problem when trying to return integers, however adding stdcall to the
function export line solved that problem.  Unfortunately it hasnt
solved the problem with passing Strings.

I have also tried safecall, cdecl (even register and pascal...i was
getting deperate ;) ) with no luck.  I also tried using PChars instead
and Char, however no luck (the number did change though).

Does anyone have any ideas how to get around this problem?  I tried to
make the most basic code to return a string so I could hopefully beat
it into submission, but still havent got anything.  The code is:

...

function getString(): String; stdcall;  //can also add safecall,
cdecl, etc
  export;

...

function getString(): String;
begin
  Result := 'work';
end;

...

Any help will be greatly appreciated.

 - Trevor



More information about the Python-list mailing list