none
Using a .Net Dll in Win32 Application RRS feed

  • Question

  • Hi.

     

    Can I use a .Net dll (C#) in Win 32 Applications (probabilly Delphi 7)?

     

    My problem:

    I have a dll wrote in Delphi that implements some communications features. This dll is used in Win32 visual apps. I´m rewrite this apps in C#, like Windows Services and the dll is not compatible with services ('cause some internal form handles). I'm thinking about to rewrite the dll in .Net, but it must be compatible with old Win32 visual app (without code changes). Is this possible?

     

    Tks

     

    Tuesday, May 27, 2008 4:54 PM

Answers

  • You cannot create native DLLs in .NET as a drop-in replacement for a DLL that was previously developped in Delphi unless you use COM.  Delphi is quite capable of using COM, so is any other language platform that's been around for the past 10 years.  If you can't change the consumer of your DLL, you'll have to forget about using .NET.
    Tuesday, May 27, 2008 11:03 PM
    Moderator

All replies

  • Possible without code changes in your Win32 app? Doubtful.

     

    Look up COM-Callable Wrapper for some idea what you can do with .NET assemblies in non-.NET apps.

    Tuesday, May 27, 2008 5:10 PM
  • Tks slidehouserules.

     

    After read somethigs about CCW, I beleive there is no way to create a new dll in .Net and use it in Win32 app without code changes.

    The actual dll is a simple dll (assembly), it isnt a COM. Today in Win32 plataform I just sign the method name to the external dll and I dont need to initialize the dll with CoCreate() or CreateObject().

    Keep this architeture is necessary, there are some third party Win32 apps and I dont have the sources to change it.

     

    []

    Tuesday, May 27, 2008 6:50 PM
  • You cannot create native DLLs in .NET as a drop-in replacement for a DLL that was previously developped in Delphi unless you use COM.  Delphi is quite capable of using COM, so is any other language platform that's been around for the past 10 years.  If you can't change the consumer of your DLL, you'll have to forget about using .NET.
    Tuesday, May 27, 2008 11:03 PM
    Moderator