Click here to Skip to main content
15,305,517 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello coders,

I have been trying to scout the internet to find a solution to my coding problem.

We have some legacy code written in Delphi4 which uses an Ocx created in VC6. This was working fine until now. The Ocx that was created communicated with a HW card which no longer is manufactured. Now the new HW card has some sample code that is created in VS2008 (C++), and what I would like to do is take this code, convert it into a dll and use this dll in delphi4.

Everytime I make a C++ Dll in VS2008 and try to run it in VB6 or delphi I get a "Cant create ActiveX" error if I use CreateObject or LoadLibrary, and if I try to add it manually as a reference I get a load error as well. Does anyone have some samle code where I can create a DLL in VS2008 using C++ and then deploying it in Vb6 and/or Delphi4???

Thank you for your help.

1 solution

Generally C++ dlls developed by two different compilers are not compatible to each other.

one simple solutions is to create the object in a factory method.
Your factory method should be exported with
extern "C"

This will remove your name mangling hurdles and you can load the library.

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