I'm creating a DLL that is going to get a value passed into it (path to a file). I am able to pass in a value, but it's getting truncted in the DLL.
Here's the code:
library SimpleLib;
Uses
SysUtils;
Var
Path : String;
o : Text;
function MySucc(AVal : PWideString; pLen : Integer) : PWideString; stdcall; begin
SetLength(String(AVal), pLen);
Assign(o, 'c:\temp\simp.txt');
Rewrite(o);
Write(o,String(AVal));
Close(o);
Result := AVal;
end;
exports
MySucc;
End.
is there a reason you're using PWideString? SysUtils has a StrPas
function that makes it fairly easy to do things like UnicodeStringVar:=StrPas(AVal); where AVal is a PWideChar .. which is usually enough for me to interact with C/C++ from pascal.
are you calling this from C# then? it would seem SetLength() is doing
Sysop: | sneaky |
---|---|
Location: | Ashburton,NZ |
Users: | 31 |
Nodes: | 8 (0 / 8) |
Uptime: | 119:53:49 |
Calls: | 2,073 |
Calls today: | 3 |
Files: | 11,135 |
Messages: | 947,293 |