The best way I found so far is to create a wrapper in managed C++, export wrapper functions from C++ dll and use in unmanaged environment.
a diluted example.
Main Topics
Browse All TopicsHi
I'm trying to import a DLL created in C# in my Win32 application, I have found some solutions for it - but one thing which are annoying me is that you have to generate a tlb file which are going to be registered in the registry.
Is it possible to import a C# DLL into a C++ (Win32 console) application without putting it into the registry?
I have read a lot about the issue on several forums and also MSDN, but right now I'm stuck maybe because I'm not that fluent in Windows programming since I'm an embedded programmer.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
The code I posted is not complete. It was just meant as a hint/pointer in the right direction. I will post a working example project once I get home. Although I would like to mention that including this managed cpp header in console app will not work because of managed pointer (csClass^) syntax. You will have to hide it from unmanaged code. I ended up using a void* instead with lots of casts in cpp.
I don't see any reason that would prevent that. how is it different from using in main (excluding scope and visibility)? Although be careful with that kind of initialization; since the class is defined in a separate module, it might not have been loaded and cause initialization issues. I am not sure what the ISO C++ spec says regarding this. Perhaps a more experienced expert could clear the doubts. or you could experiment.
Sorry for late reply, was busy yesterday.
EE does not let me upload files with any extension, so i ended up changing extensions of all files. Remove .txt extension from all files in the zip archive; open the solution; build & run unmanaged project.
I copied some stuff from gcroot.h (because some definitions were not being imported via #include). Look there for useful tricks. other useful file is vcclr.h.
Business Accounts
Answer for Membership
by: Dan7elPosted on 2009-11-04 at 05:21:18ID: 25738983
I think these techniques you're looking at are saying that a win32 application can access a .net assmebly via com interop. However, it's possible to do this without COM.
http://www.blong.com/C onferences /BorConUK2 002/Intero p1/Win32An dDotNetInt erop.htm#I nversePInv oke