Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create VB6 application using a class in a DLL, then swap out that DLL after build?

so my question is relatively simple, can I create VB6 application that references a class in a dll, and then substitute that dll for another at runtime?

Now my intial guess is... no chance in VB6.

So my thoughts turned to a VB.net interop dll. Could I do it in here, and then call the interop dll from the VB?

Again, my guess would be no.... but I'd be happy if someone knew differently.

The only thing that I think would actually work would be DI in .Net, but I'm limited to .net 2, or 3.5 at a big push, so I dont know if that is possible.

So for the background....

I have a dll that a specific site uses, but we dont want to ship that out to everyone. Instead, we want to build a clone dll which just has the interfaces setup so that the VB6 build will complete. When it gets to the site that needs it, they want to replace the dummy dll, and drop in their version instead.

Note: We do use RegFreeCOM when its gets installed, so I do have the manifest files that I could play around with if needed.

Any ideas would be much appreciated.

Nick

like image 363
Nick Avatar asked Nov 17 '11 16:11

Nick


1 Answers

Its a COM dll so its not statically linked to the VB6 exe, so long as the clsids and interface ids are the same in the type library for both DLLs, you can swap them around as you see fit. (If its a VB6 dll this is trivial to do with the 'binary compatibility' build option)

like image 143
Alex K. Avatar answered Nov 15 '22 08:11

Alex K.