我正在尝试从dll文件(C#)调用方法,但我只是得到“无法调用proc”错误消息。 这是我的代码:
ddl文件:
public class InnoEncryption
{
[DllExport("EncryptText", CallingConvention = CallingConvention.StdCall)]
public static string EncryptText([MarshalAs(UnmanagedType.LPStr)] string text)
{
return SecretKeyEncryption.EncryptText(text);
}
}
Inno.iss
[Files]
Source: "dll\InnoEncryption.dll"; Flags: dontcopy
Source: "dll\RGiesecke.DllExport.dll"; Flags: dontcopy
[Code]
function EncryptText(text: String): String;
external 'EncryptText@files:InnoEncryption.dll,RGiesecke.DllExport.dll stdcall loadwithalteredsearchpath delayload';
procedure MyProc();
var encryptedText: String;
begin
encryptedText := EncryptText(PasswordEdit.Text);
end