Yes, but it's rare to see linked libraries that use this as their API, even though it would greatly simplify FFI.
That's a terrible way to use a FFI and you would still deal with all the tricky parts.
If that's what you need, you would write a separate stand alone program and call that.