@neur0n: I already pointed that
m0skit0 wrote:I would declare better an exported constant for these,instead of a function
m0skit0 wrote: Or the HBL function itself allocates the needed space and returns a pointer (worst option so far IMO).
JJS wrote:Ok. So the return codes should be Sony style? That is >= 0 for success and < 0 for error.
JJS wrote:I must admit that I don't know how a variable import is handled usually. But I guess that an imported variable is not copied over to the importing module, but instead the variable points into the module that exports the variable. If so this sounds like a hack to me and is not really different from the last method you mentioned (that you think is the worst and I agree).
It's different on the interfacing (direct access versus API wrapper). And PSP's kernel architecture makes that work this way, I mean, some modules also export variables and they do it this way. Blame Sony
. My point here is that how's the programmer gonna know how much space he needs for the buffer to have the whole string? I mean, how long are those strings?
There should be at least a function for the size, although IMO doing it the Sony way (exporting the variable) is the right way to go, just to keep the protocol/convention used. This can be done through a function wrap if you wish.
JJS wrote: would rather copy the strings instead of exposing them directly with a pointer. This adds some protection against the homebrew messing around in HBLs memory.
Well, I agree with your point, but Sony likes to do it this way. I'm comfortable with your POV though.