using c++ .h files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rustam Asgarov

    #1

    using c++ .h files

    Hi.
    How can i use function and other things defined in c++ header file.?

  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: using c++ .h files

    Rustam,

    You can not. C# does not recognise C++ code, although there are
    similarities. If you have these functions in a DLL that exports them, then
    you can declare your functions in C#, and they will be called through the
    P/Invoke layer.

    Things like constants and enumerations though, you will have to define
    yourself.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "Rustam Asgarov" <rustam@boun.ed u.tr> wrote in message
    news:O5OYwxCtDH A.2408@tk2msftn gp13.phx.gbl...[color=blue]
    > Hi.
    > How can i use function and other things defined in c++ header file.?
    >[/color]


    Comment

    • Michael Giagnocavo [MVP]

      #3
      Re: using c++ .h files

      You can't use them directly in C#, however, you can call native DLLs (for
      instance, Kernel32.dll) using Platform Invocation (P/Invoke). Use MSDN and
      Google Groups to see many examples of how to prototype the functions you see
      defined in C++.
      -mike
      MVP

      "Rustam Asgarov" <rustam@boun.ed u.tr> wrote in message
      news:O5OYwxCtDH A.2408@tk2msftn gp13.phx.gbl...[color=blue]
      > Hi.
      > How can i use function and other things defined in c++ header file.?
      >[/color]


      Comment

      Working...