vc9.0 写的
// This is the main DLL file. #include "stdafx.h" #include "cdll.h"
int cdll::Perl::Run(char cmd)
{
system( "cmd" );
return 1;
}
// cdll.h #pragma once
#include <process.h>
using namespace System; namespace cdll { public ref class Perl
{
int Run(char cmd); };
}
在c#中调用 [DllImport(@"cdll.dll", EntryPoint = "Perl::Run", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
public extern static int Run(string cmd);
或者
cdll.Perl p = new cdll.Perl();
p.run("cmd");都出现问题,找不到Perl::Run。如何解决
// This is the main DLL file. #include "stdafx.h" #include "cdll.h"
int cdll::Perl::Run(char cmd)
{
system( "cmd" );
return 1;
}
// cdll.h #pragma once
#include <process.h>
using namespace System; namespace cdll { public ref class Perl
{
int Run(char cmd); };
}
在c#中调用 [DllImport(@"cdll.dll", EntryPoint = "Perl::Run", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
public extern static int Run(string cmd);
或者
cdll.Perl p = new cdll.Perl();
p.run("cmd");都出现问题,找不到Perl::Run。如何解决
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货