求救:C#调用Delphi的DLL,怎么也调用不成功。(100)

H

happycyp

Unregistered / Unconfirmed
GUEST, unregistred user!
Delphi2009写的DLL:function AddCompanyUsers(AUserInfo: PWideChar): Integer;
stdcall;C#(Web程序,aspx)调用代码:using System;using System.Data;using System.Data.SqlClient;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Runtime.InteropServices;public partial class AddUser{ ///private const string fileDll = @"InCenterServer.dll";
[DllImport("InCenterServer.dll", EntryPoint = "AddCompanyUsers", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.StdCall)] protected static extern int AddCompanyUsers(string userinfo);
public bool AddUsers_tj(string str) { try { AddCompanyUsers(userstr);
return true;
} catch { return false;
} } }调用出错。在Win2003,和xp下调用都不成功。不知道是代码哪里有问题,还是环境有问题。DLL中第一行先写日志,如果调用了,肯定会有日志的。但是,没有日志生成过。
 
H

happycyp

Unregistered / Unconfirmed
GUEST, unregistred user!
解决了,谁来领分。
 
J

jrq

Unregistered / Unconfirmed
GUEST, unregistred user!
我来领分。[8D]
 
H

happycyp

Unregistered / Unconfirmed
GUEST, unregistred user!
接受答案了.
 
Top Bottom