C#C
C#4y ago
danilwhale

System.EntryPointNotFound when trying to get C++ method

C# code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace CSharpEnd
{
    class Program
    {
        [DllImport("CppEnd.dll")]
        static extern int calculate(int x, int y);

        static void Main(string[] args)
        {
            Console.WriteLine(calculate(10, 20));
        }
    }
}

C++ code:
#include <iostream>

extern "C" int calculate(int x, int y) {
    return x * y + y;
}


idk what here is wrong
Was this page helpful?