I'm not clear on this, thought I should get some confirmation.

With context->NewStringFromAsciiz()  I've been assuming the
interperter makes a copy of the string, so it is okay to use local
storage

RexxMethod1(..)
{
    char buffer[64];
    ...
    return context->NewStringFromAsciiz(buffer);
}

Or if I malloc'd storage for the string, I would free it:

RexxMethod1(..)
{
    char *buffer = (char *)malloc(64);
    ...
    RexxStringObject result = context->NewStringFromAsciiz(buffer);
    free(buffer);
    return result;
}

Is that correct?  And, is it also true with context->NewString()?

Seems to me I've asked this before, and I don't remember the answer.  ;-(

Should I be, (on Windows,) using GlobalAlloc for strings that I pass
to context->NewString() or context->NewStringFromAsciiz() and leave it
to the interpreter to free the memory?

--
Confused in San Diego

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to