Making and registering a dll in C++.NET 
Author Message
 Making and registering a dll in C++.NET

I am writing a VB6 application that requires a function
subroutine for which I have C++ source code and for which
there are no equivalent VB6 statements.  Hence I purchased
VS.NET 2003 hoping to be able to compile the function in
C++.  My questions are:

1.  Is MFC.dll the proper template to use?  I did anyway.
2.  I compiled the program without errors.  VB6 will
automatically register the dll.  Does C++.NET do this?  If
not, how do I get the CLSID and register it for use by VB6?
3.  Do I have to do something special to make it an
unmanaged .dll?
4.  I intend to distribute the program to machines which
may not have either VB (any version) or C++.  I have no
problems doing this in VB.  Do I have to do something
special to include C++?

Thanks for helping this C++ newbie.



Wed, 23 Nov 2005 05:48:39 GMT  
 Making and registering a dll in C++.NET
Hi,

Quote:
> I am writing a VB6 application that requires a function
> subroutine for which I have C++ source code and for which
> there are no equivalent VB6 statements.  Hence I purchased
> VS.NET 2003 hoping to be able to compile the function in
> C++.  My questions are:
> 1.  Is MFC.dll the proper template to use?  I did anyway.

Yes it's appropriate template. But probably ATL would be more efficient.

Quote:
> 2.  I compiled the program without errors.  VB6 will
> automatically register the dll.  Does C++.NET do this?  If
> not, how do I get the CLSID and register it for use by VB6?

If you implement only raw function in C++ DLL, there is no need to register
it. If your DLL exports an ActiveX object, see *.idl(odl) file, it contains
CLSID before "coclass" statement. Or open compiled DLL by "OLE/COM Object
Viewer" supplied with VS and investigate type library. Usually ActiveX
created in VC registered automatically upon build process. On client PC this
DLL should be registered/unregistered by "regsvr32 MyActiveX.dll"/"regsvr32
/u MyActiveX.dll".

Quote:
> 3.  Do I have to do something special to make it an
> unmanaged .dll?

MFC DLL wizard creates unmanaged project.

Quote:
> 4.  I intend to distribute the program to machines which
> may not have either VB (any version) or C++.  I have no
> problems doing this in VB.  Do I have to do something
> special to include C++?

Make sure you redistributed dependent DLLs: for example if MFC library
linked as dynamic, redistribute appropriate DLLs, also sometimes CRT DLLs
should be installed as well. For more information run Dependency Walker tool
and see dependent DLLs. Hope it helps.

..
Regards,
Vadim Melnik



Wed, 23 Nov 2005 17:49:30 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Registering an MFC ActiveX control made with VC.NET fails

2. Can't register DLLs made with VC++6

3. how to use regsvr32 to register a .NET dll

4. Using VB.NET Class in C# without making as DLL

5. Register .NET DLL

6. DLL register under WINCE.NET

7. making a dll more .net friendly

8. ATL component written in VC.NET 2002 won't register on non .NET machine

9. ATL component written in VC.NET 2002 won't register on non .NET machine

10. Exe made by MSVC5.0 and Dlls made by 6.0 causes problem

11. Exe made by MSVC5.0 and Dlls made by 6.0 causes problem

12. Newbie: separate big .cs file into small .cs files

 

 
Powered by phpBB® Forum Software