Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I want to create a C++ library or DLL using Visual Studio 2008.
Now i want to use above created Library or DLL in VC++ MFC application and in C# project.

Can someone guide me how to do this.

Regards
Ramveer Singh
Posted

Hi,
One solution to use C++ libraries(in C#) is to use DllImport:
http://msdn.microsoft.com/en-us/library/aa288468%28v=vs.71%29.aspx[^]
How to Marshal a C++ Class[^]

using in MFC:
Creating and consuming MFC DLLs for Beginners[^]

I hope it helps,
Cheers.
 
Share this answer
 
Hi .NET
Platform Invoke Tutorial[^]

MFC
1. embed DLL in MFC C++ EXE?[^]
2. Extension DLLs [^]

I hope it's helps.
Roman
 
Share this answer
 
As you want to utilize the dll both in VC++ and C#, you better make this as COM dll. By this way, you can directly include it in MFC as well as refer in C# as COM Assembly
 
Share this answer
 
It might be preferable to simply share the code and compile 2 distinct DLLs. That way, you will be able to compile each one with the best options and avoid any useless code that does not apply to the platform and also have an interface that in appropriate for the usage...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900