CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Wrapping

  1. #1
    Join Date
    Mar 2009
    Location
    Florida
    Posts
    2

    Wrapping

    I have a C++ DLL/IDL, comprised of several CoClasses, which needs to be wrapped for inclusion into a C# project. My first attempt to call LoadLibrary on the wrapped dll failed; I must have not wrapped the dll correctly. Where is a good example of what needs to be accomplished for a wrapped C++ DLL to be used from within a C# project?
    Thank you for your time.

  2. #2
    Join Date
    Nov 2002
    Location
    .NET 3.5 VS2008
    Posts
    1,039

    Re: Wrapping

    I have a C++ DLL/IDL, comprised of several CoClasses, which needs to be wrapped for inclusion into a C# project
    What do you actually have? Do you a simple native Win32 DLL or do you have COM DLL? If you have a COM dll you don't need to wrap it up before you can consume it within a C# project. If you are using Visual Studio you can you can right click on the project and select 'Add reference...'. One of the tabs allows you to pick COM objects. Under the hood it will create a runtime callable wrapper for you which you don't need to worry about. If you're not using Visual Studio you can use the Framework to generate the necessary plumbing for you (I don't know how exactly but I'm sure there are a few command line utilities to do that. After all that is what Visual Studio must be using under the hood). If it is standard C++ DLL this article should point you in the right direction...

    http://msdn.microsoft.com/en-us/library/aa288468.aspx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured