Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

怎么样调用C++库的? #1

Open
qcjxberin opened this issue Nov 1, 2017 · 3 comments
Open

怎么样调用C++库的? #1

qcjxberin opened this issue Nov 1, 2017 · 3 comments

Comments

@qcjxberin
Copy link

怎么样调用C++库的?我试过一些教程,但是都是操作失败的,说是格式不对。

@ConorPai
Copy link
Owner

ConorPai commented Nov 2, 2017

.Net可以通过DllImport调用C++库中的C函数,你说操作失败具体是在哪个环节?我这个例子是在MacOS或是Ubuntu下使用CLion编译C++库,使用.Net Core调用的。Windows平台应该也可以,我们公司现在做的产品就是在Windows平台下使用WinForm调用跨平台C++库的。再就是例子中DllImport中写死C++库类型是dylib,这个是MacOS下的动态库扩展名,Linux是so,Windows是dll。

@qcjxberin
Copy link
Author

下载你的demo测试System.BadImageFormatException:“试图加载格式不正确的程序。 (Exception from HRESULT: 0x8007000B)”

@ConorPai
Copy link
Owner

ConorPai commented Mar 8, 2018

@qcjxberin 这个版本是通过.Net Core调用C++库,编译平台是MacOS,不一定适合你,我又写了一个Windows平台的通过WinForm调用C++库的测试代码,你看看这个能不能帮助到你。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants