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. Calling C/C++ function from C#

Calling C/C++ function from C#

Scheduled Pinned Locked Moved C#
c++csharptutorialquestion
7 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.
  • E Offline
    E Offline
    E6AD
    wrote on last edited by
    #1

    Can someone please tell me how to call a C/C++ function that is in a .c or .cpp file from C#?

    A 1 Reply Last reply
    0
    • E E6AD

      Can someone please tell me how to call a C/C++ function that is in a .c or .cpp file from C#?

      A Offline
      A Offline
      Andrew Kirillov
      wrote on last edited by
      #2

      Hello If the function is written on C, you can create a DLL exporting this function. Than you can interop it in C# using DllImport. With best regards, Andrew

      E 1 Reply Last reply
      0
      • A Andrew Kirillov

        Hello If the function is written on C, you can create a DLL exporting this function. Than you can interop it in C# using DllImport. With best regards, Andrew

        E Offline
        E Offline
        E6AD
        wrote on last edited by
        #3

        Thanks Andrew, And the same if it's written in C++? Can you please guide me to an article or so,so I can follow it step by step?I have never tried creating a C++ dll before? Thanks and Best Regards, E.A.

        A 1 Reply Last reply
        0
        • E E6AD

          Thanks Andrew, And the same if it's written in C++? Can you please guide me to an article or so,so I can follow it step by step?I have never tried creating a C++ dll before? Thanks and Best Regards, E.A.

          A Offline
          A Offline
          Andrew Kirillov
          wrote on last edited by
          #4

          You can browse this[^] site for question about interoping API or other functions. It's not simple to use C++ dll from C#. More of it, there is no approaches for it known to me. If you have a C++ class you can try to use it with MC++ (Managed C++) using IJW (it just works) technology. With best regards, Andrew -- modified at 7:44 Tuesday 13th September, 2005

          E 1 Reply Last reply
          0
          • A Andrew Kirillov

            You can browse this[^] site for question about interoping API or other functions. It's not simple to use C++ dll from C#. More of it, there is no approaches for it known to me. If you have a C++ class you can try to use it with MC++ (Managed C++) using IJW (it just works) technology. With best regards, Andrew -- modified at 7:44 Tuesday 13th September, 2005

            E Offline
            E Offline
            E6AD
            wrote on last edited by
            #5

            Thanks for trying to help out. I have heard about MC++ but I havent' heard about IJT. Does this mean that after using my class with MC++ that I can call it directly from .NET or what? Best Regards, E.A.

            A 1 Reply Last reply
            0
            • E E6AD

              Thanks for trying to help out. I have heard about MC++ but I havent' heard about IJT. Does this mean that after using my class with MC++ that I can call it directly from .NET or what? Best Regards, E.A.

              A Offline
              A Offline
              Andrew Kirillov
              wrote on last edited by
              #6

              Oh, sorry me very much. It's called IJW - "it just works" :doh: Look here[^] and here[^]. You can create a library on MC++ and use it from C# as any other .NET assembly. With best regards, Andrew

              E 1 Reply Last reply
              0
              • A Andrew Kirillov

                Oh, sorry me very much. It's called IJW - "it just works" :doh: Look here[^] and here[^]. You can create a library on MC++ and use it from C# as any other .NET assembly. With best regards, Andrew

                E Offline
                E Offline
                E6AD
                wrote on last edited by
                #7

                Thanks a lot Andrew, Hope this might help me sort it out. Best Regards, E.A.

                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