LoginSignup
1
1

More than 5 years have passed since last update.

手っ取り早くunityで既存cppをdll化して動かすやり方

Posted at

※これは動作確認テストのために、いろいろ端折ったものです。
 最低限すら守っていません。

動いてるcppプロジェクトのcppファイルに
exturn "C" _declspec(dllexport) int test(){return 0;}
って追加して
プロジェクトのプロパティからc/c++のsdlをnoにして
configuration Typeをdllに変更してビルド

生成されたdll群をunityに突っ込んで
using System.Runtime.InteropService;
[DllImport("dll名(拡張子要らない)")]private static extern int test();
って追加して

Debug.Log(test().toString());

ってStart(){}にでも突っ込む。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1