Jump to content

Problem calling .NET dll in Windows 2003 R2


Recommended Posts

Guest emma2740@gmail.com
Posted

Hi

I have one Server-client program running in Windows 2003 R2 server. My

program has one dll (written in C++) which calls one dll written in

C#. The program works fine in Windows XP, but it can not work well in

Windows 2003 R2. I find the error is that the C++ dll can not

CreateInstance() for the C# dll. So the C# dll can not be loaded.

I have worked a long time on it. The dlls are registered. All settings

for my program in Win 2003 R2 server is same as in the XP server.

I wonder that the cause of the problem is some security settings in

Win2003 R2.

Has anybody similar experience ? Thank you for your help!!

  • Replies 2
  • Created
  • Last Reply
Guest emma2740@gmail.com
Posted

Re: Problem calling .NET dll in Windows 2003 R2

 

I ran debug version and found that the error is the infamous 80040154

- "Class not registered".

 

The C++ code to call the C# dll is as the following:

 

HRESULT hr = m_pProxy.CreateInstance(__uuidof(ProxyConnector));

 

if(FAILED(hr))

{

TRACE("fail to createinstance(),HRESULT=%08xh ",hr);

return FALSE;

}

Guest emma2740@gmail.com
Posted

Re: Problem calling .NET dll in Windows 2003 R2

 

I soved it. The problem was in the dll which calls the c# dll. The

importing path of the xxx.tlb file is wrong. So it might not be

imported. After installation in WinXP or 2K, they maybe are more

flexible. So the c# dll can be found through the registry. But the

Win2003 is more strict. So "class not registered" error happens. When

the import path is corrected, the program doesn't need to search it in

registry.


×
×
  • Create New...