I think I need a 64-bit jsval

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

I think I need a 64-bit jsval

colinp
This post has NOT been accepted by the mailing list yet.
Microsoft Windows 7 64-bit
Visual Studio 2010

I have built a 64-bit version of SpiderMonkey and need to call it from a 64-bit application. My question is, how do I pass the address of an instantiated class in my application to the script. I believe that I need to pass it as a jval but the address will be 64-bits won't it?

When I did this all as 32-bit I used INT_TO_JSVAL:

int CConversionScript::convert(CConversionItem *source, CConversionItem *destination)
{
    jsval _function = JSVAL_VOID;

    if (JS_LookupProperty(m_Context, m_Global, "Convert", &_function) == JS_TRUE &&
        !JSVAL_IS_VOID(_function))
    {
        jsval _result = JSVAL_VOID;
        jsval _args[2];
        jsval construct_args = INT_TO_JSVAL(source);

        JSObject* _model = JS_ConstructObjectWithArguments(m_Context,
                                        &JSDataModel_t::DataModelClass,
                                        m_DataModelPrototype, NULL, 1, &construct_args);

        _args[0] = OBJECT_TO_JSVAL(_model);

        construct_args = INT_TO_JSVAL(destination);

        _model = JS_ConstructObjectWithArguments(m_Context, &JSDataModel_t::DataModelClass,
                        m_DataModelPrototype, NULL, 1, &construct_args);

        _args[1] = OBJECT_TO_JSVAL(_model);

        if (JS_CallFunction(m_Context, m_Global, JS_ValueToFunction(m_Context, _function), 2,
            _args, &_result) == JS_TRUE)
        {
             .
             .