As long as the C-function does not modify it, it will work. Otherwise you can use StrNew(PChar(YourStr)) to retrieve a copied PChar of your string.
Ah. My favorite scourge of the computer world, where somebody thinks that they know better than the end-user and try to be "helpful." If it
does work, then either it's mutating my string behind my back by changing the #0 to an unprintable char, or it's making a copy of the string, leaving out the forbidden chars, where I'm trying to avoid unnecessary copies. Either way is bad behavior. Explicit casting should be required here to do these things. I understand that at its core, it's a string backed by a fat pointer with count, which I'm all for. Usually. But I have a speed-critical use case where I must manipulate C-strings directly.
Anyway, I've got my string situation sorted out for now, for the most part. Optimization must wait until I get everything working properly. My next battle is with inheritance and pointers that end up pointing to the parent and not the child class... I've got ugly, explicit pointer casts littered all over for now plus unexpected nil pointers. The VST framework has many warts.