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. I get a problem in calling C++ dll function in C#

I get a problem in calling C++ dll function in C#

Scheduled Pinned Locked Moved C#
helpcsharpc++question
3 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.
  • D Offline
    D Offline
    dinh van hai
    wrote on last edited by
    #1

    Hello, I am trying to call c++ dll function from C#. Could anybody help me? Here is the C++ function declaration. long WINAPI GetPredictValues (double& m_vo2Max, double& m_vo2_kg_max, double& m_o2PulseMax) And this is my declaration in C#. [DllImport("c:\\ProgramFiles\\VacuMed\\turboFit\\tf32mmf.dll",SetLastError=true)] public static extern int GetPredictValues(out double vo2Max,out double vo2_kg_Max,out double o2PulseMax); And I get an error on the line below. double vo2max,vo2kgmax,o2Pulsemax; GetPredictValues( out vo2max, out vo2kgmax,out o2Pulsemax);An unhandled exception of type 'System.NullReferenceException' occurred Additional information: Object reference not set to an instance of an object Thank you for any help. Sincerely,

    D 1 Reply Last reply
    0
    • D dinh van hai

      Hello, I am trying to call c++ dll function from C#. Could anybody help me? Here is the C++ function declaration. long WINAPI GetPredictValues (double& m_vo2Max, double& m_vo2_kg_max, double& m_o2PulseMax) And this is my declaration in C#. [DllImport("c:\\ProgramFiles\\VacuMed\\turboFit\\tf32mmf.dll",SetLastError=true)] public static extern int GetPredictValues(out double vo2Max,out double vo2_kg_Max,out double o2PulseMax); And I get an error on the line below. double vo2max,vo2kgmax,o2Pulsemax; GetPredictValues( out vo2max, out vo2kgmax,out o2Pulsemax);An unhandled exception of type 'System.NullReferenceException' occurred Additional information: Object reference not set to an instance of an object Thank you for any help. Sincerely,

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      On what line does the exception occur? I don't think the exception message came up on the line that you posted... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      D 1 Reply Last reply
      0
      • D Dave Kreskowiak

        On what line does the exception occur? I don't think the exception message came up on the line that you posted... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        D Offline
        D Offline
        dinh van hai
        wrote on last edited by
        #3

        I'm sorry I had forgotten to write the line that the error message occur. The message occur on the line below: double vo2max,vo2kgmax,o2Pulsemax; GetPredictValues( out vo2max, out vo2kgmax,out o2Pulsemax); Thank you for your help Hai

        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