I have this problem, which I am dealing with for some time already. At start, I have two dlls with unmanaged code (let’s say… dll_1, dll_2) and managed aplication in c#. What i’m supposed to do is to get pointers to unmanaged functions in dll_1 in managed code, pack it into structure, and send this structure as an argument to unmanaged function in dll_2. Have anyone dealt with that kind of problem before maybe?
Share
Since you don’t do anything in managed code but the DLLs live in the same process, just use an
IntPtr(is automatically 32 or 64 bits depending on the platform) to pass the unmanaged pointer around. You can of course also insert theIntPtrinto your struct and use it as argument or return value when using an external call (e.g.[DllImport('YourDll')] static extern IntPtr ImportedFunction();).However, to give you more information, it would be necessary to know more about the DLL calls and their data structures.