Мне нужно использовать некоторые функции в C-программе. Для тестирования я определил следующее:Как загрузить C dll в код C#?
Это мой .h файл:
namespace amt
{
class AMT_EXPORT FaceRecognition
{
public:
std::string amt_test_string(std::string in);
};
};
Это мой .cpp файл:
#include <memory.h>
#include <string>
#include <iostream>
#include <fstream>
#include "api_shared.h"
#include <sys/stat.h>
using namespace std;
std::string amt::FaceRecognition::amt_test_string (std::string in)
{
std::string s="in: "+in;
std::cout<<s<<std::endl;
return s;
}
Я пытаюсь вызвать метод как это:
const string str = "C:\\minimal.dll";
[DllImport(str)]
public static extern string amt_test_string(string input);
static void Main(string[] args)
{
string myinput = "12";
string myoutput = "";
myoutput = amt_test_string(myinput);
Console.WriteLine(myoutput);
Console.Read();
}
Но я получаю сообщение о том, что он не может найти точку входа с именем amt_test_string..why so? Я новичок в C btw