Unhandled Exception: System.AccessViolationException: Attempted to read or write
问题 Below is my c++ DLL // DLL.cpp : Defines the exported functions for the DLL application. #include "stdafx.h" //#include <stdexcept> #include<iostream> using namespace std; typedef void (*FunctionPtr)(int); void (*FunctionPtr1)(int); extern "C" __declspec(dllexport)void Caller(); extern "C" __declspec(dllexport)void RegisterFunction(FunctionPtr func_ptr); extern void Caller() { int i = 10; FunctionPtr1(i); } extern void RegisterFunction(FunctionPtr func_ptr1) { FunctionPtr1 = func_ptr1; } This