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: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 991 |
Nodes: | 10 (0 / 10) |
Uptime: | 00:22:26 |
Calls: | 12,940 |
Files: | 186,574 |
Messages: | 3,262,554 |