日期:2014-05-18 浏览次数:20423 次
//问题是:一运行到下面一句后台代码,便提示:找不到DLL入口函数scan!!!当我在VC++6.0下测试DLL文件,完全正确;当我传前两 //个参数,不传第三个communtiy,也正确,一传communtiy便提示出错,为什么呢? //C++代码主要部分: char **scan(char *startip, char *endip,char *community) { char **p=new char*[255]; int status, first, last, i; int sum=0; //用来统计网段中扫描的IP数目,以在主函数中使用; char *c=new char[16]; ............. ctarget.set_readcommunity(community); //此处用到形参; } //c#调用代码: namespace docms.DLL { public class oneRouteIpScan { [DllImport("..\\dllFile\\oneRouteIpScan.dll", EntryPoint = "scan", CharSet = CharSet.Ansi , CallingConvention = CallingConvention.StdCall) ] public static extern IntPtr scan(string s1,string s2,string s3); } } //c#相关后台代码: protected void Page_Load(object sender, EventArgs e) { beginip = this.Request.QueryString["beginIp"].ToString().Trim(); endip = this.Request.QueryString["endIp"].ToString().Trim(); community = this.Request.QueryString["community"].ToString().Trim(); ...................... IntPtr p = docms.DLL.routeIpScan.scan(beginip, endip,community); }