Question:
Importing C++ files in VB.Net?
Sam27
2008-12-31 22:58:47 UTC
when i try to import C++'s .dll file, it is not supporting.....what should be done......plz help....
Three answers:
2009-01-04 15:37:24 UTC
I'm not sure how you are trying to import the dll because there are several ways to "import" a dll, but you can reference an external DLL regardless of the language the DLL was written in. It's not always easy however, because the parameter types may not always match.



The easiest way to do this is to add a reference. If the DLL was compiled with interop in mind, then, in your VB.NET compiler, click on project->add a reference, then browse for the dll and add it to your project. If you are lucky, the new dll's namespace will show up in your object explorer and you will see it's available properties and methods.



If you are not lucky, then you need to go around the problem. You will need to write the code to make sure that the DLL is installed and registered on the users Machine if you are going to distribute your application, if you are only going to use the application yourself, then you can skip that, just make sure that you've registered the DLL before you use it or you will get an error. Then you need to add a prototype to your application.



Private Declare Sub PortOut Lib "IO.DLL" (ByVal Port As Integer, ByVal Data As Byte)



this is a prototype for VB from the IO.DLL that you can get for free from here

http://www.geekhideout.com/iodll.shtml



The documentation from the DLL that you are trying to reference usually will have some documentation that will help you construct the prototype.
kushoo
2009-01-01 13:15:05 UTC
hello dear

C++ not create .dll file it always Create four type files

.cpp, .obj, .bak, .exe there is no option of .dll.



and remember C++ and VB.net have different translator and defirent fuction(methods). simply we can say both are defirent.



So my dear U cant do that. if u want use C++ files in VC++ then u can.

I hope u get it.

GOOD LUCK happy new year
2009-01-01 08:01:27 UTC
I don't think so u can import C++'s .dll files there as the message says- not supporting


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...