重複の可能性:
C++ クラスとそのメンバー関数の名前マングリング?
Visual C++ dll を作成しました。それは機能しており、c# でこの dll を介して cuda から Thrust メソッドを呼び出すことができます。
唯一の問題は、関数名を解読できないことです。通常の名前にしたいので、規則でエントリポイントを使用する必要はありません。
これが私のコードです。これは私のヘッダーです
//ThrustCH.h
#pragma once
enter code here__declspec(dllexport) class ThrustFuncs
{
__declspec(dllexport) static int maxValueThrust(int *data, int N);
__declspec(dllexport) static double maxValueThrust(double *data, int N);
__declspec(dllexport) static int* sort(int* data, int N);
__declspec(dllexport) static double* sort(double* data, int N);
__declspec(dllexport) static int simple(int N);
};
これは私のcppです
// thrustDLL.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
#include "thrustH.h"
#include "thrustCH.h"
extern "C" {
__declspec(dllexport) int ThrustFuncs::maxValueThrust(int *data, int N){
return thrustH::maxValue(data,N);
}
__declspec(dllexport) double ThrustFuncs::maxValueThrust(double *data, int N){
return thrustH::maxValue(data,N);
}
__declspec(dllexport) int* ThrustFuncs::sort(int* data, int N){
return thrustH::sort(data,N);
}
__declspec(dllexport) double* ThrustFuncs::sort(double* data, int N){
return thrustH::sort(data,N);
}
__declspec(dllexport) int ThrustFuncs::simple(int N){
return N;
}
}
extern "C" と __declspec(dllexport) をほぼどこでも使用しようとしましたが、何か間違っていると思います。私を手伝ってくれますか?