If you’re loading a DLL into the same process, then you should be able to use CUDA interop on buffer and image resources, but as said, be very careful with the CUDA alignment restrictions.
Once you have a CUDA resource handle, you can access the underlying device data.
I’m showing that for OpenGL in my OptiX 7 examples. Search for m_interop
in this file for example:
https://github.com/NVIDIA/OptiX_Apps/blob/master/apps/rtigo3/src/DeviceSingleGPU.cpp
There was very similar discussion recently which effectively does the same with D3D11 and boils down to another CUDA header and the resp. D3D11 variants of the resource registering calls, the rest behaves identical:
https://forums.developer.nvidia.com/t/unity3d-rendertexture-texture2d-to-optiximage2d/156408