ObjectARX

Reply
Valued Contributor
joseph_l
Posts: 68
Registered: ‎03-09-2006
Message 1 of 7 (725 Views)
Accepted Solution

Problem Registering COM Server

725 Views, 6 Replies
08-24-2011 04:24 PM

I need help!!!

I have added a COM wrapper to the DBX of a project that I am developing. It all worked fine on the computer that I am developing it on but when I tried to install the plugin on a different machine I cannot get the COM server to register.

Here are some of the details.

Developing for AutoCAD 2009,
Using ObjectARX 2009 VC++ 2005 SP1.


I tried to both register the COM at install time and at run time but I can't get either to work.


Install-time COM Registration:
I can't get it to register with "regsvr32.exe myDBX_COM.dbx". Either on the development machine (Win 7 x64) or the test machine (Win 7 x64). MyDBX_COM.dbx is installed in "c:\Program Files\Common Files\Autodesk Shared". It says that the module "myDBX_COM.dbx" failed to load. I used the dependency walker to see if I am missing any dlls and added the AutoCAD 2009 folder to the search path. It says I have an error opening MFC80U.DLL, VCOMP.DLL, GPSVC.DLL and IESHIMS.DLL. From what I understand the last two are delay-load and are not a problem. But I do not understand why the first two cannot be found. They are not missing directly from myDBX_COM.dbx but indirectly from ACDB17.DLL. But when I open that file in the dependency walker only GPSVC.DLL and IESHIMS.DLL are missing from it. I also tried moving my dbx file to the AutoCAD 2009 folder but still no change.


Run-time COM Registration:
When I run the plugin on the test computer it fails to register the COM server. The HRESSULT message from DLLRegisterServer is "Access is denied". When I run in Admin mode it succeeds, but on subsequent runs in normal mode I get the error message again. What is unusual is that it is able to register on the development computer whether or not I am in Admin mode at run time and I do not get any error messages.    

If I could get run-time COM registration without having to run AutoCAD in Admin mode I would be happy with that but I would be most happy with figuring out how to get it to register at install-time.

I have read everything that I can find about this on the forums but I still can't figure it out.

Any thoughts would be very appreciated!!!

Thank you!

Joseph  

It is possible to create an .arx module that can load in a non-AutoCAD process, but it requires some work and there are some hitches. First, you'll need to remove any implicit linkage to AutoCAD. You can explicitly link to AutoCAD by demand-loading any AutoCAD related modules. If you do this, then you have to ensure that no code tries to call any functions from the demand-loaded modules from within DllMain or the RegisterServer. Next, you'll need to either remove the dependency on the C runtime modules, demand-load them as well, and add your own hook to find and load them from the GAC, or add them to the manifest so the Windows loader can find them. Of course, adding them to the manifest will introduce the potential version clash with AutoCAD when it loads into the AutoCAD process. All this can be done to some degree. However, let me offer some advice. Forget about registering your COM modules at runtime, and just register them at install time the old fashioned way. It's a PITA, but once you've spent a few minutes hard coding the needed registry keys into your installer script, your applications will install worry-free and run without problems on every Windows version and every Windows architecture, and you'll never again have to waste time trying to get RegSvr32 to load your DLL.
Distinguished Mentor
owenwengerd
Posts: 635
Registered: ‎08-06-2002
Message 2 of 7 (713 Views)

Re: Problem Registering COM Server

08-24-2011 05:21 PM in reply to: joseph_l

This might help:
http://otb.manusoft.com/2007/01/my-manusoft-manifest-manifesto.htm

--

Owen Wengerd

ManuSoft

--
Owen Wengerd
ManuSoft
Valued Contributor
joseph_l
Posts: 68
Registered: ‎03-09-2006
Message 3 of 7 (696 Views)

Re: Problem Registering COM Server

08-26-2011 03:11 PM in reply to: owenwengerd

Thank you Owen!

 

Very busy now but I will take a look at that the first chance I get!

 

Much appreciated!

 

Joseph

Valued Contributor
joseph_l
Posts: 68
Registered: ‎03-09-2006
Message 4 of 7 (695 Views)

Re: Problem Registering COM Server

08-27-2011 10:05 AM in reply to: owenwengerd

Owen,

I read the article. It was very useful!!!!! It shed a lot of light on the issue for me! I changed the COM DBX to be un-manifested and I statically linked the ATL. This has definitely simplified everything for me! But I am still having problems registering the COM server. I will bullet point a few questions that I still don't understand.

 

  • Can I do a run-time registration of a COM server without running AutoCAD in Admin mode? (I appear to be able to do it on the development machine so I think it may be possible.)
  • When I run regsvr32.exe to register the COM server it still says the module failed to load. The dependency walker now say the DBX COM file is missing MSVCP80.DLL and MSVCR80.DLL. as well as some AutoCAD files. As this file no longer has a manifest how do I link to the VC files when registering the COM server with regsvr32?  
  • What method of registration do you recommend? (Run-time or Install-time)

Thank you!

 

Greatly appreciated!

 

Joseph

Distinguished Mentor
owenwengerd
Posts: 635
Registered: ‎08-06-2002
Message 5 of 7 (692 Views)

Re: Problem Registering COM Server

08-27-2011 11:05 AM in reply to: joseph_l
It is possible to create an .arx module that can load in a non-AutoCAD process, but it requires some work and there are some hitches. First, you'll need to remove any implicit linkage to AutoCAD. You can explicitly link to AutoCAD by demand-loading any AutoCAD related modules. If you do this, then you have to ensure that no code tries to call any functions from the demand-loaded modules from within DllMain or the RegisterServer. Next, you'll need to either remove the dependency on the C runtime modules, demand-load them as well, and add your own hook to find and load them from the GAC, or add them to the manifest so the Windows loader can find them. Of course, adding them to the manifest will introduce the potential version clash with AutoCAD when it loads into the AutoCAD process. All this can be done to some degree. However, let me offer some advice. Forget about registering your COM modules at runtime, and just register them at install time the old fashioned way. It's a PITA, but once you've spent a few minutes hard coding the needed registry keys into your installer script, your applications will install worry-free and run without problems on every Windows version and every Windows architecture, and you'll never again have to waste time trying to get RegSvr32 to load your DLL.
--
Owen Wengerd
ManuSoft
Valued Contributor
joseph_l
Posts: 68
Registered: ‎03-09-2006
Message 6 of 7 (670 Views)

Re: Problem Registering COM Server

09-01-2011 02:18 PM in reply to: owenwengerd

Thank you Owen,

 

I have created a manuel registration of the COM server at install time like you suggested. It works great!!

 

Thanks so much! It feels like I've been beating my head against the wall on this one! So to finally get it figured out is fantastic. I thank you and my head thanks you! :smileyhappy:

 

Joseph

Distinguished Mentor
owenwengerd
Posts: 635
Registered: ‎08-06-2002
Message 7 of 7 (424 Views)

Re: Problem Registering COM Server

02-20-2013 02:01 PM in reply to: owenwengerd

I've added a more detailed explanation of "manual" registration in a blog post here:

http://otb.manusoft.com/2011/10/registering-an-arxbrx-module-as-a-com-server.htm

--
Owen Wengerd
ManuSoft
Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.