简体   繁体   中英

Load mfc DLL in C#

I have an mfc dll that I like to load into an C sharp program!

My source tutorial: http://blogs.msdn.com/b/jonathanswift/archive/2006/10/03/dynamically-calling-an-unmanaged-dll-from-.net-_2800_c_23002900_.aspx

The problem is that he use primitive data types (eg int) in the function to load, but I need own types (the class object for getInstance() )!

Is there an easy way to do that?

Thank you, greets leon22

You can't consume C++ classes in a C# project. In fact you can't consume C++ classes in any project compiled with a different compiler, eg a different version of MSVC.

Your best approach here is to use COM which is a binary interface standard designed to solve exactly this problem.

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