You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys, I am using managedCuda as part of a dll that is loaded as plugin for another C# software.
To package the plugin, an application provided by the software vendor runs the following piece of code:
From what I gather it is listing all types inside the .dll that I've built and its dependencies to search for plugins.
But when it gets to the managedCuda.dll it crashes with the following exception:
[0] {"Could not load type 'ManagedCuda.BasicTypes.CudaExternalMemoryHandleDesc' from assembly
'ManagedCuda, Version=11.0.43.0, Culture=neutral, PublicKeyToken=242d898828717aa0'
because it contains an object field at
offset 4 that is incorrectly aligned or overlapped by a non-object
field.":"ManagedCuda.BasicTypes.CUDA_EXTERNAL_MEMORY_HANDLE_DESC"}
System.Exception {System.TypeLoadException}
Do you happen to know why this is happennig and if I can compile managedCuda in such a way to prevent this?
I've tried to compile managedCuda in 64bit only with no success. Aligning the fields to 8 bits offsets can solve this?
The text was updated successfully, but these errors were encountered:
I was fighting a lot with ManagedCuda.BasicTypes.CudaExternalMemoryHandleDesc to get the fields aligned as in the original C struct (C# and C-unions don't go well together), and NVidia also changed it for the newer versions...
I'm not totally sure if the current layout actually works for all cases, so far no one seems to have ever used it (it is only used for the new graphics API interop replacing the older OpenGL/DirectX interfaces). And your DLL-loader mechanism seems to check stronger than the actual compiler. So just delete the two struct members that are aligned to FieldOffset 4 and it should run smoothly.
Hey Michael, removing the two fields with offset 4 does the trick!
Me and a teammate were battling this one for the good part of the last week thinking it was something with the vendor's software because we had issues before.
Anyways, I own you a beer or a beverage of choice 🤣
Hi guys, I am using managedCuda as part of a dll that is loaded as plugin for another C# software.
To package the plugin, an application provided by the software vendor runs the following piece of code:
From what I gather it is listing all types inside the .dll that I've built and its dependencies to search for plugins.
But when it gets to the managedCuda.dll it crashes with the following exception:
Do you happen to know why this is happennig and if I can compile managedCuda in such a way to prevent this?
I've tried to compile managedCuda in 64bit only with no success. Aligning the fields to 8 bits offsets can solve this?
The text was updated successfully, but these errors were encountered: