I don't think you will be able to cast `h` to a `SafeHandle` derived type, as the pointer(as well as the object being pointed at) is owned by the native code (the cast here is to `NotOwnedSafeHandleBase` derived type). I think you either need to do what you are doing here, or treat the submodule handle as an `IntPtr`. Maybe we should consider having `NotOwnedSafeHandleBase` not derive from `SafeHandle` (with updated naming), as we are not using any of the safe bits. Just a thought, I have not fully thought it through.