Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / October 2007

Tip: Looking for answers? Try searching our database.

DllRegisterServer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
George - 29 Oct 2007 09:07 GMT
Hello everyone,

I am wondering when function DllRegisterServer will be invoked? I am using
Visual Studio 2005 to develop an in-process native (unmanaged) C++ COM. I am
wondering when it will be invoked?

1. During the build process or during the DLL initialization process?
2. I find this function only works for debug mode, not release mode. Is that
correct?

In MSDN,

http://msdn2.microsoft.com/en-us/library/ms682162.aspx

there are not too much information about when this method will be invoked
and whether it works for both debug mode code and release mode code.

thanks in advance,
George
David Lowndes - 29 Oct 2007 09:45 GMT
>I am wondering when function DllRegisterServer will be invoked?

Whenever something calls it!

>1. During the build process or during the DLL initialization process?

Does you build process have a step to call regsvr32 to register (i.e.
call that function)?

>2. I find this function only works for debug mode, not release mode. Is that
>correct?

It may only be getting called in the debug configuration of your
project.

Dave
George - 29 Oct 2007 10:29 GMT
Thanks Dave,

I do not explicitly call regsvr32 in build process. For the build process, I
simply use Visual Studio 2005 IDE to build. :-)

I suspect regsvr32 invokes DllRegisterServer since I set the following
option to yes in debug configuration,

Linker --> General --> Register Output to yes

But I am not sure. Any comments?

regards,
George

> >I am wondering when function DllRegisterServer will be invoked?
>
[quoted text clipped - 12 lines]
>
> Dave
David Lowndes - 29 Oct 2007 11:08 GMT
>I do not explicitly call regsvr32 in build process. For the build process, I
>simply use Visual Studio 2005 IDE to build. :-)
[quoted text clipped - 5 lines]
>
>But I am not sure. Any comments?

Yes, that's what that option does:

"Register Output
Run regsvr32.exe /s $(TargetPath), which is valid only on .dll
projects.
"

Dave
George - 29 Oct 2007 11:17 GMT
Thanks Dave,

Where do you find the statements?

> "Register Output
> Run regsvr32.exe /s $(TargetPath), which is valid only on .dll
> projects.
> "

from MSDN or? I want to take a formal look. Thanks.

regards,
George

> >I do not explicitly call regsvr32 in build process. For the build process, I
> >simply use Visual Studio 2005 IDE to build. :-)
[quoted text clipped - 14 lines]
>
> Dave
David Lowndes - 29 Oct 2007 13:21 GMT
>Where do you find the statements?
>
[quoted text clipped - 4 lines]
>
>from MSDN or? I want to take a formal look. Thanks.

Yes, it's in MSDN help - I just clicked the ? help icon in the caption
bar of that property page.

Dave
George - 29 Oct 2007 15:12 GMT
Thanks Dave,

I have found it. I think DllRegisterServer and Register output option should
work for both debug version and release version, right?

regards,
George

> >Where do you find the statements?
> >
[quoted text clipped - 9 lines]
>
> Dave
David Lowndes - 29 Oct 2007 15:18 GMT
>Thanks Dave,
>
>I have found it. I think DllRegisterServer and Register output option should
>work for both debug version and release version, right?

There's no reason I can think of why they shouldn't! :)

Dave
George - 29 Oct 2007 15:33 GMT
Thanks for all the help, Dave!

regards,
George

> >Thanks Dave,
> >
[quoted text clipped - 4 lines]
>
> Dave
Frank Hickman - 29 Oct 2007 18:30 GMT
> >Thanks Dave,
>>
[quoted text clipped - 5 lines]
>
> Dave

Actually, the reason is because the installation software is supposed to
register the DLL during installation.  The debug version is setup to
register the DLL for debugging.

Signature

============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.

David Lowndes - 29 Oct 2007 19:27 GMT
>Actually, the reason is because the installation software is supposed to
>register the DLL during installation.  The debug version is setup to
>register the DLL for debugging.

Yes, that's the reason the default's are the way they are, but there's
nothing to prevent anyone changing it if they want to.

Dave
Frank Hickman - 29 Oct 2007 21:29 GMT
> >Actually, the reason is because the installation software is supposed to
>>register the DLL during installation.  The debug version is setup to
[quoted text clipped - 4 lines]
>
> Dave

Very true.

Signature

============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.

George - 30 Oct 2007 06:30 GMT
Thanks Frank,

I think you mean there are some difference configurations for debug build
and release build in Visual Studio 2005, which causes the different behavior,
right? Could you point out what do you mean the different setting in Visual
Studio 2005 which is the root cause please?

regards,
George

> > >Thanks Dave,
> >>
[quoted text clipped - 9 lines]
> register the DLL during installation.  The debug version is setup to
> register the DLL for debugging.
Frank Hickman - 30 Oct 2007 08:40 GMT
> Thanks Frank,
>
[quoted text clipped - 7 lines]
> regards,
> George

Just as you mentioned and David confirmed, the configuration setting
"Linker->General->Register Output" is set for the debug config and not the
release.  This is by default the way it is set when the project is created
because of the previously mentioned reason.

Signature

============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.

George - 30 Oct 2007 09:45 GMT
Thanks Frank,

I think if we set Linker->General->Register Output to true in release mode,
it should also work, right?

regards,
George

> > Thanks Frank,
> >
[quoted text clipped - 12 lines]
> release.  This is by default the way it is set when the project is created
> because of the previously mentioned reason.
Frank Hickman - 30 Oct 2007 19:25 GMT
> Thanks Frank,
>
[quoted text clipped - 4 lines]
> regards,
> George

Yes.

Signature

============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.

Frank Hickman - 30 Oct 2007 19:34 GMT
>> Thanks Frank,
>>
[quoted text clipped - 6 lines]
>
> Yes.

I should mention that in a batch build, the debug version usually builds
last by default, just the order the project settings are created when the
project is created, so your debug version would be the one registered last.

Signature

============
Frank Hickman
NobŸ/ft, Inc.
============
Replace the _nosp@m_ with @ to reply.


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.