Delphi写的DLL,c#中如何调用?

walkline 2006-12-25 04:16:24
delphi的dll代码如下:
procedure GetSystemCode( result:pchar);stdcall;
var
CPUID : TCPUID;
I : Integer;
m_cpuid : string;
m_biosinfo:string;
RBD: TRomBiosDump;
CSTR:String;
begin
。。。

c#调用方法:
[DllImport("CryLibray.dll")]
public static extern void GetSystemCode(byte[] str);
-----------------------------------------------------------------
怎么出现这样的错误呀?

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
谢谢
...全文
106 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
walkline 2006-12-25
  • 打赏
  • 举报
回复
[DllImport("CryLibray.dll")]
public static extern void GetSystemCode(byte[] str);

private void button1_Click(object sender, EventArgs e)
{
byte[] mybyte=new byte [100];
GetSystemCode(mybyte);
}
呵呵,我加了长度,怎么byte[0]到byte[99]都是空呀?是不是procedure GetSystemCode( result:pchar);stdcall;写错了呀!
cangwu_lee 2006-12-25
  • 打赏
  • 举报
回复
procedure GetSystemCode(var result:pchar);stdcall;

还是长度的问题


--------------------------------------------------------------
程序,犹如人生。

110,566

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧