//----------------------C#-------------------//
private const string dll = "iihFounder.dll";
[DllImport(dll, EntryPoint = "FounderRequestData", SetLastError = true,
CharSet = CharSet.Ansi/Unicode, ExactSpelling = true,
CallingConvention = CallingConvention.StdCall)]
public static extern int FounderRequestData(String userName, String businessType, String userIP, String requestData, out String responseData);
//----------------------Delphi-------------------//
function FounderRequestData(const userName: PChar;?const businessType: PChar; const userIP: PChar;?const requestData: PChar; out responseData: PChar): Integer; stdcall;
var
pinput:PChar;
begin
pinput:= PChar(VarToStr(back));
if pinput = nil then Exit;
S := Format('%s',[pinput]);
Move(S[1], responseData^, Min(Size, Length(S)+1));
end;

本文展示了如何在C#和Delphi中调用同一DLL文件实现数据请求功能。通过DllImport和stdcall说明了不同语言间如何正确进行参数传递和返回值处理。
893

被折叠的 条评论
为什么被折叠?



