none
Calling Managed DLL from Unmanaged Code

    Question

  •  

    I am calling a function in Managed DLL from Unmanaged Code. When I run the Unamanaged Project which calls a function in Managed DLL I get the following error

     

    fatal error C1083 Error loading type library/dll.

     

    Let me know the solution asap.

     

     

    thanks and regards.

    Friday, October 26, 2007 9:39 PM

Answers

  • Hi DirectXpert,

    Based on my understanding, you write a managed DLL and exposed it as COM and use it in unmanaged C++, but you came across this error.

    To access the method provided by the managed object, you can first register this DLL as COM class in your system using Assembly Registration Tool (Regasm.exe) then use it like normal COM class in C++.

    If this does not solve this issue, could you please post some code? To troubleshoot this issue, we really need the source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business logic from it.

    Thanks!

    Monday, October 29, 2007 12:04 PM

All replies

  • Hi DirectXpert,

    Based on my understanding, you write a managed DLL and exposed it as COM and use it in unmanaged C++, but you came across this error.

    To access the method provided by the managed object, you can first register this DLL as COM class in your system using Assembly Registration Tool (Regasm.exe) then use it like normal COM class in C++.

    If this does not solve this issue, could you please post some code? To troubleshoot this issue, we really need the source code to reproduce the problem, so that we can investigate the issue in house. It is not necessary that you send out the complete source of your project. We just need a simplest sample to reproduce the problem. You can remove any confidential information or business logic from it.

    Thanks!

    Monday, October 29, 2007 12:04 PM
  • I have been able to solve the problem. I am doing mistake while using RegAsm.exe.I am not using correct spaces between parameters of RegAsm.Anyway thanks for ur reply and help.

     

    thanks and regards

    Thursday, November 01, 2007 5:58 PM