unity调用c++


#pragma once
#include "dlltest.h"
extern "C"
{
	_declspec(dllexport) int add(int a, int b);
	typedef int(*ApiAdd)(int, int);
}


public class DLLConnect : MonoBehaviour {
    [DllImport("dlltest")]
    public static extern int add(int x, int y);
    // Use this for initialization
    void Start () {
        int i=add(10,11);
        Debug.Log(i);
 }
}

你可能感兴趣的:(unity调用c++)