c# can not load a c++ DLL
-
I followed a tutorial, created a basic DLL and created a sum function which returns the sum of two integers. The code compiles fine and DLL is created. However when i use it in c# and load it as reference, it give me error. It says 'reference can not be added. Make sure the file is accessible and a valid com object'. What could be the problem? Thanks
-
I followed a tutorial, created a basic DLL and created a sum function which returns the sum of two integers. The code compiles fine and DLL is created. However when i use it in c# and load it as reference, it give me error. It says 'reference can not be added. Make sure the file is accessible and a valid com object'. What could be the problem? Thanks
The problem is that you can only reference COM and .NET DLLs in .NET. You can, however, use p/invoke to link to and call methods in a plain vanilla dll, like the one you created.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
The problem is that you can only reference COM and .NET DLLs in .NET. You can, however, use p/invoke to link to and call methods in a plain vanilla dll, like the one you created.
Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )