Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/magento/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 从本机dll加载到RAM中作为字节数组的DllImport函数是否仍然存在?_C#_Runtime_Bytearray_Dllimport_Native Code - Fatal编程技术网

C# 从本机dll加载到RAM中作为字节数组的DllImport函数是否仍然存在?

C# 从本机dll加载到RAM中作为字节数组的DllImport函数是否仍然存在?,c#,runtime,bytearray,dllimport,native-code,C#,Runtime,Bytearray,Dllimport,Native Code,不管听起来有多奇怪,我都需要它 另一个解决方案是,如果可以将本机DLL作为字节数组加载到RAM中,但是在没有DllImport>的情况下从那里调用函数,则需要调用适当的方法将本机DLL加载到调用过程中。GitHub上的项目提供了一个(本机)API来处理这个问题,您可以从C++/CLI项目中使用它 将native.dll加载到进程中后,可以使用获取的“WeirdativeFunction”的句柄,并将其转换为托管委托,然后调用托管委托 byte[] dll_data = File.RealAllB

不管听起来有多奇怪,我都需要它
另一个解决方案是,如果可以将本机DLL作为字节数组加载到RAM中,但是在没有DllImport>的情况下从那里调用函数,则需要调用适当的方法将本机DLL加载到调用过程中。GitHub上的项目提供了一个(本机)API来处理这个问题,您可以从C++/CLI项目中使用它

native.dll
加载到进程中后,可以使用获取
的“WeirdativeFunction”
的句柄,并将其转换为托管委托,然后调用托管委托

byte[] dll_data = File.RealAllBytes("native.dll"); //this is just example, in real architecture bytes comes from another source and should never be stored on HDD
//uhh... ohh... do something to call exported function named "WeirdNativeFunction"