Access a C++ object under 4.0.1 64-bit

Developers
2010-10-01
2012-08-14
  • George Triantafyllos

    I have created an interface to a C++ object following the instructions in the
    manual but i don't seem to be able to reach its methods.

    when I execute: ---- f = foo~init ----- I get the following runtime error

    Error 91 running D:\cppProg\rexx\apiTest\rxTest.rex line 42: No result object

    Error 91.999: Message "INIT" did not return a result

    In the DLL, which otherwise works fine, I defined the following:

    REXX_METHOD_PROTOTYPE(foo_init);

    ....

    RexxMethodEntry foo_methods =

    {

    REXX_METHOD(foo_init, foo_init),

    REXX_LAST_METHOD()

    };

    ....

    RexxMethod0(RexxObjectPtr, foo_init)

    {

    printf("inside foo::init()\n");

    foo *f = new foo();

    RexxPointerObject data = context->NewPointer( f );

    context->SetObjectVariable("MYDATA", data);

    .....

    }

    The code never reaches the printf() inside foo_init()

    Any help to point out what I do wrong will be greatly appreciated.

     
  • Rick McGuire

    Rick McGuire - 2010-10-01

    What's the ooRexx class code look line for this? You'll also need to have a
    ::method statement in your class definition that maps the INIT method to your
    external foo_init method.

    Rick

     
  • George Triantafyllos

    Do you mean that for my C++ foo class I have to have an ooRexx equivalent ?

    I though once I create foo_init, foo_compute, etc in my DLL I can right away
    create a foo object.

    In this case how do I call foo_init for the ooRexx init method?

    bty, thanks for the quick response,

    br, George

     
  • Rick McGuire

    Rick McGuire - 2010-10-01

    All you've done is create a native method. In order to use this with a class,
    you need to have a ::class definition that defines all of the methods of that
    class. This is necessary for each method that is implemented using native
    code. For example,

    ::class myclass

    ::method init external "LIBRARY foolib foo_init"

    says that the INIT method of MyClass is implemented by the external code
    located in the foolib library. These method definitions tell the interpreter
    where the backing method code exists.

     
  • George Triantafyllos

    Ok, I failed the course....

    Thank you so much for the tip. Works now fine!!!

     

Log in to post a comment.