5,391
社区成员
发帖
与我相关
我的任务
分享
//delphi编写的DLL函数
function ReportServer(const ServerTypeParams: TServerTypeParams; var RetValue: PChar;var RetValueLen: Integer): Boolean;stdcall;
//TServerTypeParams结构体的定义
TServerTypeParams= record
ServerType: PChar;
Template: PChar;
DefaultTemplate: PChar;
end;
//对应结构体定义
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi,Pack=1)]
public struct TServerTypeParams
{
[MarshalAs(UnmanagedType.LPStr)]
public string ServerType;
[MarshalAs(UnmanagedType.LPStr)]
public string Template;
}
//对应结构体定义,上面发帖的时候少黏贴了一个DefaultTemplate
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi,Pack=1)]
public struct TServerTypeParams
{
[MarshalAs(UnmanagedType.LPStr)]
public string ServerType;
[MarshalAs(UnmanagedType.LPStr)]
public string Template;
[MarshalAs(UnmanagedType.LPStr)]
public string DefaultTemplate;
}