On Mon, Jul 21, 2008 at 6:21 AM, Rick McGuire <[EMAIL PROTECTED]> wrote:

> I think I spotted the problem.  The problem was with the unint32_t
> value as a return value rather than passing it as an argument.

Rick, somehow I missed this reply completely this morning.  It brings
up an interesting point ( interesting to me.)

I was working with the native Rexx methods over the weekend and it did
not dawn on me that I could use the value types like CSTRING,
wholenumber_t, int, etc., for the return value type.  I've been
returning RexxObjectPtr for every native method.  And using
context->xxx to create the return.

Now it seems perfectly obvious to me (after reading your sentence
<grin>) that you can use the value types to specify a different return
type, just as you can an arg type.  The light bulb over the head
cartoon.

So instead of this

RexxMethod2(RexxObjectPtr, pbc_setStep, OSELF, self, OPTIONAL_int32_t, newStep)
{
  ...
    int previous = (int)SendMessage(hwnd, PBM_SETSTEP, newStep, 0);
    return context->NumberToObject(previous);

I could be doing this:

RexxMethod2(int, pbc_setStep, OSELF, self, OPTIONAL_int32_t, newStep)
{
 ...
    return (int)SendMessage(hwnd, PBM_SETSTEP, newStep, 0);

Much better.  Is it more efficient to have the interpreter kernel do
the conversion rather than using context->NumberToObject()?  Seems
like it might be.  It would certainly reduce the amount of code in the
external function DLL slightly.  Which could add up if there a large
number of external functions in the DLL.

The design of the new API is looking pretty good the more I dig into it.

--
Mark Miesfeld

-------------------------------------------------------------------------
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