Search code examples
c#managed-c++

Calling function from C# DLL in MC++ code


i have a c# dll that contains classes for communication with fiscal device. The problem is that i have to access the classes from MC++ program.

Can anyone give me few tips or direction on how i may do this. Thanks for all the help in advance.


Solution

  • as stated in the comment by codeteq you need to add a reference to the c# assembly.

    also in your code you need to reference it - this example:

    //hello.cpp
    #using <mscorlib.dll>
    using namespace System;
    
    int main()  {
      Console::WriteLine("Hello, world!");
      return 0;
    }
    

    is from http://en.wikipedia.org/wiki/Managed_Extensions_for_C%2B%2B

    this article provides more info: http://support.microsoft.com/kb/310674