Link to a C ++ project in a C # project in visual studio 2008

Is it possible to reference a C ++ project in a C # project? I tried to add a link in a C # project to this C ++, but I get an error "Link could not be added"

+3
source share
3 answers

If your C ++ project is a native (standard C ++) project, then no. If this is a managed project, you can add a link to it.

For native code, you will need to use P / Invoke to access functions in the C ++ DLL.

+2
source

DLL. , CLI ( .NET CLR) COM- ( VS DLL). .

+6

-. C, ++, # Lisp . , ++ → # ++. ( -), , Adder ++ #:

using System;
using System.Collections.Generic;
using System.Text;

namespace Dllcaller
{
    class Program
    {
        static void Main(string[] args)
        {
            Adder a = new Adder();
            Console.WriteLine(a.add(1, 7));
            while (true) ;
        }
    }
}
0
source

Source: https://habr.com/ru/post/1752925/


All Articles