如何编译SWIG生成的C#文件到.NET的DLL?文件、SWIG、DLL、NET

2023-09-05 01:13:37 作者:仰望天空、独自高傲づ

在this螺纹,马克·伯尼尔提到痛饮也产生了一堆,我编译成一个.NET的DLL C#中的文件。

我生成的C#文件,我的课了。但我真的想不出如何构建成.NET的DLL。我完全入门到.Net和DLL。

看来我'@'是不是在这里工作。 @MarcBernier。或任何人知道我该怎么联系马克?

-------编辑---------

感谢您的回答!我把所有生成的类在命名空间MyProjectName

编译它,似乎它的工作,我把生成的C#DLL到单声道和编辑器可以自动完成的 MyprojectName.ClassName.Method()。

但是编译器也抱怨: EntryPointNotFoundException:SWIGRegisterExceptionCallbacks_MaxFlowGraph

(在此之前,它抱怨DLL没有找到,所以我把原来的C ++ DLL,它停止了)

我使用的是单声道的Win7下32位,并且不知道发生了什么 - 我是一个菜鸟,我需要帮助,帮助

这是22点36分在澳大利亚这样的圣诞快乐的家伙!

解决方案

创建类型的类库中的Visual Studio 新项目。然后右键单击该项目,选择的添加>现有项目的..然后选择由痛饮产生的所有生成的 *。CS 文件。 SHIFT + CTRL + B 和它编译。

In this thread, Marc Bernier mentioned "SWIG also generated a bunch of C# files which I compiled into a .NET DLL".

C 中dll文件的生成和调用

I generated the C# files for my class too. But I really can not figure out how to build that into a .Net Dll. I'm totally noob to .Net and DLL.

Seems I '@' is not working here. @MarcBernier. Or anyone knows how can I contact Marc?

-------edit---------

Thanks for the answer! I put all generated classes under namespace MyProjectName

compiled it and seems it worked, I put the generated C#DLL into Mono and the editor can auto complete MyprojectName.ClassName.Method().

But the compiler also complained: EntryPointNotFoundException: SWIGRegisterExceptionCallbacks_MaxFlowGraph

(Before that it complained DLL not found, so I put in the original C++ dll and it stopped)

I'm using Mono under Win7 32bit, and no idea what's happening -- I'm a noob, I need help, help.

It's 22:36pm here in Australia so MERRY CHRISTMAS guys!

解决方案

Create a new project in Visual Studio of type Class Library. Then right-click the project and select Add > Existing items.. Then select all generated *.cs files generated by SWIG. Shift+Ctrl+B and it compiles.