「C++の応用 - C Sharp DLLの使用」の版間の差分

ナビゲーションに移動 検索に移動
編集の要約なし
編集の要約なし
編集の要約なし
23行目: 23行目:
== C++/CLIを使う方法 ==
== C++/CLIを使う方法 ==
Visual C++のプロジェクト設定を開いて、[共通言語ランタイム サポート (/clr)]に変更する。<br>
Visual C++のプロジェクト設定を開いて、[共通言語ランタイム サポート (/clr)]に変更する。<br>
  <source lang="cpp">
  <source lang="c#">
  // SampleDLL.cs
  // SampleDLL.cs
  namespace SampleDLL
  namespace SampleDLL
35行目: 35行目:
     }
     }
  }
  }
</source>
   
   
<source lang="c++">
  // SampleEXE.cpp
  // SampleEXE.cpp
  #include <Windows.h>
  #include <Windows.h>
53行目: 55行目:
== C# DLL側で関数をエクスポートする方法 ==
== C# DLL側で関数をエクスポートする方法 ==
まず、プロジェクトを作成してソースコードを記述する。<br>
まず、プロジェクトを作成してソースコードを記述する。<br>
  <source lang="cpp">
  <source lang="c#">
  // SampleDLL.cs
  // SampleDLL.cs
  namespace SampleDLL
  namespace SampleDLL
66行目: 68行目:
     }
     }
  }
  }
</source>
   
   
<source lang="c++">
  // SampleEXE.cpp
  // SampleEXE.cpp
  #include <Windows.h>
  #include <Windows.h>
91行目: 95行目:


== C++/CLIのラッパープロジェクトを使用する方法 ==
== C++/CLIのラッパープロジェクトを使用する方法 ==
  <source lang="cpp">
  <source lang="c#">
  // CSharpDLL.cs
  // CSharpDLL.cs
  namespace CSharpDLL
  namespace CSharpDLL
113行目: 117行目:
     }
     }
  }
  }
</source>
   
   
<source lang="c++">
  // CppCLI.cpp
  // CppCLI.cpp
  #include "stdafx.h"
  #include "stdafx.h"

案内メニュー