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. How to call a Function in VC++ from C#?

How to call a Function in VC++ from C#?

Scheduled Pinned Locked Moved C#
csharpc++tutorialquestion
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.
  • S Offline
    S Offline
    ss431
    wrote on last edited by
    #1

    Hi all, I'm new to .NET .I have A function which declared in VC++ like LONG GetData(VARIANT *varData) This function returns the data of type double through this varData variable. How could i call this function from C#? Thanks in advance?

    N N 2 Replies Last reply
    0
    • S ss431

      Hi all, I'm new to .NET .I have A function which declared in VC++ like LONG GetData(VARIANT *varData) This function returns the data of type double through this varData variable. How could i call this function from C#? Thanks in advance?

      N Offline
      N Offline
      Niiiissssshhhhhuuuuu
      wrote on last edited by
      #2

      Hi, Its better you create a DLL of your VC ++ class and call that DLL from your c# application using DLL Import atribute. and use that function . you will get lots of exaples of that in code project , just try to search it. Regards, Regards :rose:, Nishu

      1 Reply Last reply
      0
      • S ss431

        Hi all, I'm new to .NET .I have A function which declared in VC++ like LONG GetData(VARIANT *varData) This function returns the data of type double through this varData variable. How could i call this function from C#? Thanks in advance?

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        To call a C++ function from C#, you need to create a wrapper class in C# which uses C++ dll methods. Then call the C# method. You need to use DllImport


        My Website | Ask smart questions

        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