Can the CuArray/CuPtr in CUDA.jl be directly passed to foreign functions?

Since it’s likely that your C/C++ program is a different process you’ll have to use the CUDA IPC API. https://github.com/NVIDIA/cuda-samples/tree/master/Samples/simpleIPC