2016-08-17 9 views
0

私が作成した2つのDLLは、Assets/Pluginsにあります。 1つは正常に動作しているようですが、もう1つはEntryPointNotFoundExceptionを返しますが、コードはまったく同じように見えます。たぶん私はVisualStudioで見逃したいくつかの設定がありますか?どのような設定が必要ですか?EntryPointNotFoundExceptionが1つのDLL内にありますが、別のDLLで表示されます

動作するものは、次のようになります。

C#

[DllImport("winBlinkDetect")] 
    private static extern void IsSeven(ref int x); 

[DllImport("winBlinkDetect")] 
    private static extern int PrintFive(); 

void Start() 
    { 
     int test = 0; 
     Debug.Log("x = " + test); 
     IsFive(ref test); 
     Debug.Log("x = " + test); 
     Debug.Log(PrintFive()); 
    } 

C++ヘッダーに動作しないものについては

#if _MSC_VER // this is defined when compiling with Visual Studio 
#define EXPORT_API __declspec(dllexport) // Visual Studio needs annotating exported functions with this 
#define _USE_MATH_DEFINES 
#else 
#define EXPORT_API // XCode does not need annotating exported functions, so define is empty 
#endif 

#ifdef __cplusplus 
extern "C" { 
#endif 

    void EXPORT_API IsFive(int *y); 
    void EXPORT_API IsSeven(int *x); 
    int EXPORT_API PrintFive(); 


#ifdef __cplusplus 
} 
#endif 
C++ .cpp 

void IsFive(int *y) 
{ 
    *y = 5; 
} 

void IsSeven(int *x) 
{ 
    *x = 7; 
} 

int PrintFive() 
{ 
    return 99; 
} 

: C#

[DllImport("brain")] 
    private static extern int GiveNinetyNine(); 

    [DllImport("brain")] 
    private static extern void IsFive(ref int x); 

void Start() 
    { 
     int test = 0; 
     Debug.Log("x = " + test); 
     IsFive(ref test); 
     Debug.Log("x = " + test); 
     Debug.Log(GiveNinetyNine()); 
    } 

#if _MSC_VER // this is defined when compiling with Visual Studio 
#define EXPORT_API __declspec(dllexport) // Visual Studio needs annotating exported functions with this 
#define _USE_MATH_DEFINES 
#else 
#define EXPORT_API // XCode does not need annotating exported functions, so define is empty 
#endif 

#include <string>; 

#ifdef __cplusplus 
extern "C" { 
#endif 

    // test functions 
    void EXPORT_API IsFive(int *y); 
    void EXPORT_API IsSeven(int *x); 
    int EXPORT_API GiveNinetyNine(); 
#ifdef __cplusplus 
} 
#endif 
C++ .cpp 

void IsFive(int *y) 
{ 
    *y = 5; 
} 

void IsSeven(int *x) 
{ 
    *x = 7; 
} 

int GiveNinetyNine() 
{ 
    return 99; 
} 

答えて

1

Dependency Walker C++ヘッダーには、エクスポート機能を示していないが、ヘッダファイル内のエクスポート機能がよさそうです。 hファイルがcppファイルに含まれていないようです。これをチェックするには、関数定義の中にcppの中に__declspec(dllexport)を入れてください。

+0

これは本当に素晴らしいツールです。ありがとうございます。私が働いているもののチェックをすると、すべての機能がうまくいきません。私が働いていないもののチェックをすると、何も表示されません。 – mBajema

+0

@mBajema良い兆候は、サンプルプラットフォーム(x86またはx64)の両方のDLLをコンパイルしたことを確認してください。 – Nikita

+0

私は、両方とも構成マネージャーでリリース構成プラットフォームx64として設定しています。 – mBajema

関連する問題