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. C#
  4. Need C++ Library in C# Class Library

Need C++ Library in C# Class Library

Scheduled Pinned Locked Moved C#
csharpc++comdiscussion
6 Posts 3 Posters 1 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.
  • T Offline
    T Offline
    ThatsAlok
    wrote on last edited by
    #1

    Dear All,   i have a Unmanaged c++ based Library and i want to use it C# application(i.e. it expose some c based function .. ).. could some one give some pointer to use unmanaged library in c#.. so that i don't have to provide some extra dll or lib with c# to my end user....  thanks in advance

    "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

    cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

    N 1 Reply Last reply
    0
    • T ThatsAlok

      Dear All,   i have a Unmanaged c++ based Library and i want to use it C# application(i.e. it expose some c based function .. ).. could some one give some pointer to use unmanaged library in c#.. so that i don't have to provide some extra dll or lib with c# to my end user....  thanks in advance

      "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

      cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      ThatsAlok wrote:

      so that i don't have to provide some extra dll

      It doesn't work that way, you will still need to include the C++ dll.


      only two letters away from being an asset

      T 1 Reply Last reply
      0
      • N Not Active

        ThatsAlok wrote:

        so that i don't have to provide some extra dll

        It doesn't work that way, you will still need to include the C++ dll.


        only two letters away from being an asset

        T Offline
        T Offline
        ThatsAlok
        wrote on last edited by
        #3

        Mark Nischalke wrote:

        t doesn't work that way, you will still need to include the C++ dll.

        i have C++ Library and related Header file.. now if get some pointer to proceed .. that will be great help from your side :).. i am little confused how to call these function in c#...

        "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

        cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

        N 1 Reply Last reply
        0
        • T ThatsAlok

          Mark Nischalke wrote:

          t doesn't work that way, you will still need to include the C++ dll.

          i have C++ Library and related Header file.. now if get some pointer to proceed .. that will be great help from your side :).. i am little confused how to call these function in c#...

          "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

          cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          Using Unmanaged code and assembler in C#[^]


          only two letters away from being an asset

          T 1 Reply Last reply
          0
          • N Not Active

            Using Unmanaged code and assembler in C#[^]


            only two letters away from being an asset

            T Offline
            T Offline
            ThatsAlok
            wrote on last edited by
            #5

            Mark Nischalke wrote:

            Using Unmanaged code and assembler in C#[^]

            thats a great article...! sorry if i sounding like child.. could i use to DLLimport to import my ABC.lib.. or  i have to use some other method!

            "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

            cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

            T 1 Reply Last reply
            0
            • T ThatsAlok

              Mark Nischalke wrote:

              Using Unmanaged code and assembler in C#[^]

              thats a great article...! sorry if i sounding like child.. could i use to DLLimport to import my ABC.lib.. or  i have to use some other method!

              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

              cheers, Alok Gupta VC Forum Q&A :- I/ IV Support CRY- Child Relief and you

              T Offline
              T Offline
              Tim Paaschen
              wrote on last edited by
              #6

              DllImport only works with unmanaged DLLs. An unmanaged static library (LIB) can't be used this way from C#. Only C++/CLI can mix managed and unmanaged code. As far as I can see you have 4 options: - Take the sources and convert them to C#. - Change the unmanaged project to build a DLL and then use DllImport. - Create a mixed mode (managed - unmanaged) wrapper DLL in C++/CLI. - Write the client application in C++/CLI.

              Regards, Tim

              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