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. .NET (Core and Framework)
  4. Call by Reference Problem

Call by Reference Problem

Scheduled Pinned Locked Moved .NET (Core and Framework)
helpcsharpc++regexquestion
2 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.
  • A Offline
    A Offline
    ashLin123
    wrote on last edited by
    #1

    I m trying to use Method where arguments are pass by reference of Managed C++ Code in C#.But the error is coming like: The best overloaded method match for 'ManagedDLL.Class1.BoxPropertiesMG(double, double, double, double*, double*)' has some invalid arguments cannot convert from 'ref double' to 'double*' Source Code for this is given below: //Managed C++ Dll Code: public __gc class Class1 { public: void BoxPropertiesMG(double L, double H, double W, double& A, double& V) { BoxProperties(L, H,W, A, V); } }; C# Code: class Class1 { static void Main(string[] args) { ManagedDLL.Class1 ob = new ManagedDLL.Class1(); double L=2.0, W=3.0, H=4.0; double A, V; Console.WriteLine(ob.BoxPropertiesMG(L,H,W,ref A, ref V)); } } Can Someone help me to solve this problem ?

    J 1 Reply Last reply
    0
    • A ashLin123

      I m trying to use Method where arguments are pass by reference of Managed C++ Code in C#.But the error is coming like: The best overloaded method match for 'ManagedDLL.Class1.BoxPropertiesMG(double, double, double, double*, double*)' has some invalid arguments cannot convert from 'ref double' to 'double*' Source Code for this is given below: //Managed C++ Dll Code: public __gc class Class1 { public: void BoxPropertiesMG(double L, double H, double W, double& A, double& V) { BoxProperties(L, H,W, A, V); } }; C# Code: class Class1 { static void Main(string[] args) { ManagedDLL.Class1 ob = new ManagedDLL.Class1(); double L=2.0, W=3.0, H=4.0; double A, V; Console.WriteLine(ob.BoxPropertiesMG(L,H,W,ref A, ref V)); } } Can Someone help me to solve this problem ?

      J Offline
      J Offline
      jj3pa
      wrote on last edited by
      #2

      Don't know for sure if this will help, as I never worked on C++ working with C#, but I was looking into __gc* pointers in the the .NET docs ... I wonder if that would help you. Good luck, Jerry

      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