473,324 Members | 2,567 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

registering mixed mode DLLs (regsvr32)

I have a COM dll that defines a COM object.
I used to register it either during link or using regsvr32.

Now I have compiled one of the C++ files in the DLL with /clr so now I have
a mixed DLL.
The problem is that the DLL registration no longer works.
Regsvr32 succeeds but the GUIDs of the COM objects no longer present in the
registry
and when somebody tries to CreateInstance of them, I get an error "Class Not
Registered".

Is there any magic that makes it possible to register such DLL?

Thanks in advance,
Genady
Aug 16 '06 #1
2 3841
Yes, that's a pity in VS.NET. If you have a project that produces an
assembly, and use the linker setting to register the output, they will use
RegAsm to register the .NET types instead of RegSvr32.
You should avoid this setting and use a custom build step instead.

Marcus

"Genady Beryozkin" <ge****@spammerscatch.algotec.co.ilwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>I have a COM dll that defines a COM object.
I used to register it either during link or using regsvr32.

Now I have compiled one of the C++ files in the DLL with /clr so now I
have a mixed DLL.
The problem is that the DLL registration no longer works.
Regsvr32 succeeds but the GUIDs of the COM objects no longer present in
the registry
and when somebody tries to CreateInstance of them, I get an error "Class
Not Registered".

Is there any magic that makes it possible to register such DLL?

Thanks in advance,
Genady

Aug 17 '06 #2
That wasn't the problem. I tried to manually register the DLL with
regsvr32 and it didn't work either.

I found two things that when combined did help:
1. define the _ATL_MIXED macro
2. Initialize the CComModule global in a managed code section. The original
problem was that the InitInstance() was not called (for a reason that I
don't fully understand). After placing the CComModule initialization in a
managed section the InitInstance is called
correctly and the registration proceeds as expected.

Maybe it's a know problem and I'm only treating the symptoms, so if anybody
has a clue what it's all about - please let me know. I know we're using old
COM classes. Would using
ATL8.0 help?

Genady

"Marcus Heege" <no****@heege.netwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Yes, that's a pity in VS.NET. If you have a project that produces an
assembly, and use the linker setting to register the output, they will use
RegAsm to register the .NET types instead of RegSvr32.
You should avoid this setting and use a custom build step instead.

Marcus

"Genady Beryozkin" <ge****@spammerscatch.algotec.co.ilwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>I have a COM dll that defines a COM object.
I used to register it either during link or using regsvr32.

Now I have compiled one of the C++ files in the DLL with /clr so now I
have a mixed DLL.
The problem is that the DLL registration no longer works.
Regsvr32 succeeds but the GUIDs of the COM objects no longer present in
the registry
and when somebody tries to CreateInstance of them, I get an error "Class
Not Registered".

Is there any magic that makes it possible to register such DLL?

Thanks in advance,
Genady


Aug 20 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Edward Diener | last post by:
I received no answers about this the first time I posted, so I will try again. My inability to decipher an MSDN topic may find others who have the same inability and someone who can decipher and...
7
by: Staale L. Hansen | last post by:
We have an application which uses some mixed-mode code to expose a .NET 1.1 managed API. Only the necessary files are compiled with /clr. We want to be able to load the application without .NET...
1
by: Chris Petchey | last post by:
I have a VB.NET application which installs/updates other applications. Some of these other applications are VB6. Part of the processing includes registering the OCXs and DLLs and I use the...
2
by: Todd | last post by:
Hi Guys, Ive hit a problem that I just can't find a solution to... Ive created an application that downloads images from a digital camera. The application is written in C# and uses the WIA...
3
by: Benjamin Harper | last post by:
Hi, I've recently upgraded a mixed-mode MFC DLL of mine from VS2003 to VS2005 using the newer /clr language. In the process I also removed the manual entry point stuff that used to be necessary....
1
by: Bruce Wood | last post by:
Can anyone explain to me (in simple terms, please :) ) what is the difference between setting the Register property for a DLL in a Setup project to COM versus COMRelativePath versus COMSelfReg? ...
5
by: DFB | last post by:
I am the author of the ZLibNetWrapper project on SourceForge (located at zlibnetwrapper.sf.net). This project is a simple mixed-mode .NET wrapper around the ZLib compression library. The ZLib...
3
by: gopal | last post by:
I am developing an application in CSharp - windows forms based, which copies the DLLs both unmanaged and managed DLLs from a shared folder and will overwrite the existing versions of managed &...
5
by: =?Utf-8?B?aWduaGVucnk=?= | last post by:
I have a managed C++ project and two C# projects. All are class library projects. The C++ project links with native C++ static libraries and references to one C# project. The projects structure...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.