idiomatic C memory ownership

Hello,

I’ve started working on fresh SDL3 binding for Haskell. I have decent familiarity with C itself, but not much familiarity with C’s idioms. When an entry point into SDL accepts a pointer, is it in general (unless the documentation states otherwise) only necessary to keep the pointer valid until the entry call returns? I already went spelunking into the implementation to check up on one instance of this; doing that repeatedly doesn’t seem like a good use of my time. Strings are of particular concern; for example, it would take extra care to force a client app to encode its metadata in a fixed region of memory known at load time, as is idiomatic in C.

honestly I don’t know. maybe you would be doing god’s work if you patched the official documentation with your discoveries as you suffer, then do a pull request to enlighten future binding developers and other uneasy developers like me

You may need to talk about the C api for us to know what you’re talking about

It depends on the call. For strings SDL will generally copy the string internally if it needs to reference it later.