Archive: Get value from dll function (delphi)


Get value from dll function (delphi)
Hello.
I created a custom page.
On it, there's a field i'd like to encrypte.
So i want to make a dll with Delphi;
I Tried this but it doesn't work

********* Delphi code *****************
function Crypte(texte:ShortString):ShortString;
begin
result:='toto';//i can't show you the code :(
end;
**********************************

********** NSIS code ************************
System::Call 'DllFunctions::Crypte(t 9) t .9'
MessageBox MB_OK "$9"
**********************************

The value of $9 is "" and not "toto" !?
What's wrong ?


I've found.
I post here the solution :

***********Delphi code****************
function Crypte( varIn:pchar):pchar;cdecl;
begin
result:=pchar('toto');
end;

***********NSIS code****************

System::Call "$EXEDIR\DllFunctions::test(t 'titi') t .r9"
MessageBox MB_OK "texte récupéré par NSIS $9"


Please use [code] around it because you've got smilies in there :(

-Stu


With [code] it appears the same, Afrow UK. You (butch22) should disable smiles in your posts which have only codes next time.


Sorry.
Here is the code :
Delphi :


function Crypte( varIn:pchar):pchar;cdecl;
var
tmp:string;
begin
tmp:= varIn ;
tmp:=Cryptage(tmp);
result:=pchar(tmp);
end;

NSIS :

System::Call "$EXEDIR\Utils::Crypte(t r5) t .r5"