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. Class of C++ to be used in C#

Class of C++ to be used in C#

Scheduled Pinned Locked Moved C#
csharpc++question
4 Posts 3 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.
  • C Offline
    C Offline
    clint1982
    wrote on last edited by
    #1

    I created a class in Visual C++.NET 2005 and I tried to use it in C#.NET 2005 I have a function in the class that has a parameter of char * and in C# it is seen as sbyte * I was wondering what's the difference ? And how can I make C# see the char * variable as char * so that it can be used as a string. If it isn't possible, please suggest alternatives. Thanks, Clint

    A G 2 Replies Last reply
    0
    • C clint1982

      I created a class in Visual C++.NET 2005 and I tried to use it in C#.NET 2005 I have a function in the class that has a parameter of char * and in C# it is seen as sbyte * I was wondering what's the difference ? And how can I make C# see the char * variable as char * so that it can be used as a string. If it isn't possible, please suggest alternatives. Thanks, Clint

      A Offline
      A Offline
      Alex Korchemniy
      wrote on last edited by
      #2

      C++ classes are not compatible with C#. However, you can call a specific function using P/Invoke. Just search for it. Alex Korchemniy

      1 Reply Last reply
      0
      • C clint1982

        I created a class in Visual C++.NET 2005 and I tried to use it in C#.NET 2005 I have a function in the class that has a parameter of char * and in C# it is seen as sbyte * I was wondering what's the difference ? And how can I make C# see the char * variable as char * so that it can be used as a string. If it isn't possible, please suggest alternatives. Thanks, Clint

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        In C++ the char datatype is a signed byte. In C# the char datatype is a Unicode character, e.g. a 16 bit data type. You have to decode the C++ string from whatever encoding it uses. Look in the System.Runtime.InteropServices namespace if there is something built-in that does this. --- b { font-weight: normal; }

        C 1 Reply Last reply
        0
        • G Guffa

          In C++ the char datatype is a signed byte. In C# the char datatype is a Unicode character, e.g. a 16 bit data type. You have to decode the C++ string from whatever encoding it uses. Look in the System.Runtime.InteropServices namespace if there is something built-in that does this. --- b { font-weight: normal; }

          C Offline
          C Offline
          clint1982
          wrote on last edited by
          #4

          thanks

          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