How to compile C# application with C++ static libr

2019-01-18 04:19发布

I turned my C++ Dynamic link library into Static library just to acquire more knowledge. My question is how can I use the .obj file to compile both projects with C# express/MS visual studio?

标签: c# c++ static
4条回答
走好不送
2楼-- · 2019-01-18 04:54

The way to "use" a static library in C# is to first create a Managed C++ wrapper that will provide a facade for the rest of the managed world. As everyone else has already commented, C# only supports DLLs for P/Invoke.

查看更多
beautiful°
3楼-- · 2019-01-18 04:58

No way to do that.

Only call DLL functions in runtime or create a COM object from your library

查看更多
爷的心禁止访问
4楼-- · 2019-01-18 05:04

"Static library" means that the library is going to be merged with your final application. This concept doesn't exist in .net. .net supports DLLs only.

查看更多
成全新的幸福
5楼-- · 2019-01-18 05:15

No, you can't access static libraries directly from C#. You have to use a DLL.

查看更多
登录 后发表回答