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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Access vector from C#

Access vector from C#

Scheduled Pinned Locked Moved C / C++ / MFC
c++csharpasp-netgraphicsdata-structures
3 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.
  • R Offline
    R Offline
    Reza Shademani
    wrote on last edited by
    #1

    Hello, I want to access my native functionalities from an unmanaged dll which performs my core processings. clinet program will be written by C# and i use DLLImport attribute to mix managed and native codes. How could i pass STL vector params between C# and C++? If there is no robust method of doing this, what's the remedy to send and receive array like data between C# and C++?

    http://www.packetforum.org

    C J 2 Replies Last reply
    0
    • R Reza Shademani

      Hello, I want to access my native functionalities from an unmanaged dll which performs my core processings. clinet program will be written by C# and i use DLLImport attribute to mix managed and native codes. How could i pass STL vector params between C# and C++? If there is no robust method of doing this, what's the remedy to send and receive array like data between C# and C++?

      http://www.packetforum.org

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      A vector is an array internally ( that is, it's continuous memory ). Therefore, if you set up an equivelant class in C# ( assuming it's not just a simple type ), you should be able to pass it through.

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      1 Reply Last reply
      0
      • R Reza Shademani

        Hello, I want to access my native functionalities from an unmanaged dll which performs my core processings. clinet program will be written by C# and i use DLLImport attribute to mix managed and native codes. How could i pass STL vector params between C# and C++? If there is no robust method of doing this, what's the remedy to send and receive array like data between C# and C++?

        http://www.packetforum.org

        J Offline
        J Offline
        Joe Woodbury
        wrote on last edited by
        #3

        Reza Shadmani wrote:

        How could i pass STL vector params between C# and C++?

        No. (Assuming you want to retain the full integrity of the vector, vs. just the data.) For examples on how to pass arrays of data, look at P/Invoke.

        Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

        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