Click here to Skip to main content
15,888,803 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
Whether is to possible to use a c# class in vc++ without using the dll.
I had done it by using the dll(Which is converted to Typelibrary and accessed all the functions in the c# class by using the Interface smart pointer). But now i need to reduce the overhead. Please help me.

Thanks,
Laje..
Posted
Updated 15-Feb-11 18:21pm
v2

"Without the DLL" sounds ridiculous! You could also say "without C# file". Well, change DLL extension to something else, you will have without DLL :-)

Seriously, using .NET assembly by native (unmanaged) code is a problem. Is that what you tried so far? Suggested use is COM, but I this is not very good option, due to overhead (you're right here), registry contamination and general trend of getting COM gradually obsolete.

I already answered how to use .NET Assembly directly. Many would say it is impossible, but this is not true. This is not well-known method, but it is robust and based on the standard.
See: loading C# DLL in MFC[^].

—SA
 
Share this answer
 
Comments
Satheesh1546 16-Feb-11 0:56am    
what just i mean it is without registering the dll.
Sergey Alexandrovich Kryukov 16-Feb-11 20:06pm    
Now I see. I was right in my assumptions: my answer exactly is what you need, no registration, no contamination of your registry at all. And -- this is the only method like that.

So, please try out and accept my answer formally, consider voting.

Good luck,
--SA
I dont think there is a way other than COM interop that can help you achieve this.
One is managed code and the other is unmanaged code.
 
Share this answer
 
I agree with abhinav here, since both use different plateform and old unmanaged plateform is not modified to use managed plateform.

As per software lifecycle, it's duty of newer application/language to provide backward compatibility not older lanaguage to gain forward compatability.

If you see, you can use win32 based dll directly in managed enviornment by using DLLIMPORT (backward compatibility).

similarly managed enviornment provided you tools to convert dll to be used in unmamnged enviornment.
 
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