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. Managed C++/CLI
  4. Quickest Way to Wrap Standard Win32 DLL?

Quickest Way to Wrap Standard Win32 DLL?

Scheduled Pinned Locked Moved Managed C++/CLI
csharpc++toolshelp
2 Posts 2 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.
  • R Offline
    R Offline
    RichB
    wrote on last edited by
    #1

    All, I have a "standard" Win32 DLL with the C header. I'd like to create a Managed C++ assembly (DLL) which can be used by the other .NET languages such as C# and VB.NET. Must I write all the code manually to expose the data structures and methods? Is there a tool or utility which will allow me to do this quickly? I appreciate your help. Thanks, RB

    U 1 Reply Last reply
    0
    • R RichB

      All, I have a "standard" Win32 DLL with the C header. I'd like to create a Managed C++ assembly (DLL) which can be used by the other .NET languages such as C# and VB.NET. Must I write all the code manually to expose the data structures and methods? Is there a tool or utility which will allow me to do this quickly? I appreciate your help. Thanks, RB

      U Offline
      U Offline
      ursus zeta
      wrote on last edited by
      #2

      You might take a look around over at: www.PInvoke.net If the standard Win32 DLLs were Type Libraries you could simply use the Type Library Importer to convert them to .NET assemblies (TlbImp.exe, it lives in the Program Files\Microsoft Visual Studio .NET folder). Most people just use the Win32 functions in their code by using the DllImport attribute before the function declaration. You must add the line "using namespace System::Runtime::InteropServices;" to your code, and the DLLImport attribute requires that you supply a String object, for instance, "User32.dll" as a parameter. You could, of course, do this for the entire DLL, but, it would keep you busy for awhile. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemruntimeinteropservicesdllimportattributeclasstopic.asp[^] I think the reasoning behind the Interop method has to do with Type safety by the managing CLR.

      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