简体   繁体   中英

How do I call native C++ code from a C# project in an environment where I can't reference a C++/CLI library?

I want to call native C++ code from a windows phone 8.1 project. I was going off this How do I call C++/CLI from C#? for a while up until I found out that I can't reference a C++/CLI library in my windows phone project... too bad, because that would've been very convenient.

How ought I go about this?

You can also use Platform Invoke. It's much lighter weight, but you should be pretty comfortable about translating the definitions in the header files to .NET types. And don't even bother trying straight C++--it's doable but really messy. Wrap it in a C API and dynamically bind that.

https://msdn.microsoft.com/en-us/library/26thfadc(v=vs.110).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM