Squirrel

The programming language
Welcome to Squirrel Sign in | Join | Help
in Search

const pointer function arguments

Last post 08-22-2008, 2:11 PM by Toji. 2 replies.
Sort Posts: Previous Next
  •  08-21-2008, 12:35 PM 2710

    const pointer function arguments

    It seems that when I try to export a function that uses a constant pointer to an instance type the type cannot be resolved. Simple example:

    DECLARE_INSTANCE_TYPE_NAME(MyType)

    void MyFunc(const MyType* x) {
        //...
    }

    SQClassDef<MyType>(_T("MyType")).
            staticFunc(&MyFunc, _T("MyFunc"));

    When I try to compile that, it complains that "none of the n overloads could convert all the argument types", and then points to "const MyType*" as the failed type. Looking at the list of available types above it, though, we do have:

    MyType &
    MyType *
    const MyType &


    It would seem that "const MyType *" would be the logical progression from this. Is there something special that needs to be done to expose this type, or is this a bug in squirrel?
  •  08-22-2008, 9:26 AM 2713 in reply to 2710

    Re: const pointer function arguments

    You should uncomment
    #define SQPLUS_CONST_OPT
    in SqPlus.h
  •  08-22-2008, 2:11 PM 2714 in reply to 2713

    Re: const pointer function arguments

    I have, and while this allows me to bind const member functions (MyClass::MyFunc() const) and use const references (const MyObj&), it doesn't seem to provide any mechanism for using const pointers (const MyObj*).
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems