-1

I want to call a c++ dll from my visual basic windows forms application in Visual Studio 2010. I tried out google and various other forums,but most of them seem to be concerned about much earlier versions of Visual Studio.(I know how to create a c++ dll and call it from a c++ application in VS2010) .I found in msdn website that you can do this(calling C++ dll from VB) using _stdcall and .def files but I did not get how to modify my existing C++ dll(containing _declspec(dllexport)/(dllimport)) with _stdcall and create a .def file to use it. I am a beginner in this field so I will appreciate a step by step tutorial in creating C++ dll(for use in VB2010),a .def file and calling them from VB2010.

  • Unless you're fairly masochistic, you probably want to turn your C++ DLL into an ActiveX control, which you can use from VB fairly easily (via .NET's COM interop layer). – Jerry Coffin Jun 23 '13 at 15:28
  • 2
    This is endlessly covered by both the MSDN library and *many* tutorials. Adding yet another one you still can't make work just doesn't make any sense. You'll need to properly describe your problem to get an answer here. – Hans Passant Jun 23 '13 at 15:32
  • possible duplicate of [Using C++ DLL in VB.NET](http://stackoverflow.com/questions/15155237/using-c-app-in-net) – Raymond Chen Jun 23 '13 at 16:36

1 Answers1

0

Just generate a COM project with either MFC or ATL, using dual dispatch -- VB must recognise it as native stuff. There are many tutorials on the web, but if you can't find one, I can suggest Wrox books on beginning COM programming for your chosen framework.

Text for old version is good, you just have to locate where the functionality is on the new interface. It is all there, almost the same way.

Balog Pal
  • 16,195
  • 2
  • 23
  • 37