Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. .NET (Core and Framework)
  4. How can I use a native DLL in .Net 2005?

How can I use a native DLL in .Net 2005?

Scheduled Pinned Locked Moved .NET (Core and Framework)
csharpc++helpquestiondotnet
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    a_kiani
    wrote on last edited by
    #1

    Hi dear friends. I've ported a native (Unmanaged) C++ DLL to managed and used in .Net 2003. Now I'm going to use this ported DLL it in .Net 2005. I change the compiler option /clr to /clr:oldSyntax and compile with no error. But at run-time I get a exception when I want to use the DLL in a C# client. The error message is: MyDLL.dll is attempting managed execution inside OS loader lock. Do not attempt to run managed code inside a DLLMain... Anyone can help me?

    S L 2 Replies Last reply
    0
    • A a_kiani

      Hi dear friends. I've ported a native (Unmanaged) C++ DLL to managed and used in .Net 2003. Now I'm going to use this ported DLL it in .Net 2005. I change the compiler option /clr to /clr:oldSyntax and compile with no error. But at run-time I get a exception when I want to use the DLL in a C# client. The error message is: MyDLL.dll is attempting managed execution inside OS loader lock. Do not attempt to run managed code inside a DLLMain... Anyone can help me?

      S Offline
      S Offline
      soma420
      wrote on last edited by
      #2

      Not sure but this might help http://www.pinvoke.net

      1 Reply Last reply
      0
      • A a_kiani

        Hi dear friends. I've ported a native (Unmanaged) C++ DLL to managed and used in .Net 2003. Now I'm going to use this ported DLL it in .Net 2005. I change the compiler option /clr to /clr:oldSyntax and compile with no error. But at run-time I get a exception when I want to use the DLL in a C# client. The error message is: MyDLL.dll is attempting managed execution inside OS loader lock. Do not attempt to run managed code inside a DLLMain... Anyone can help me?

        L Offline
        L Offline
        liRetro
        wrote on last edited by
        #3

        If your DLL has any custom functions in DllMain then move them out ASAP. I ran into a lock problem on the DllMain of a COM object loaded under .NET; It's not quite the same problem but Microsoft told me to move all my code out of there. Assert(this);

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups