no support for c++builder users.

edited 2:18AM in FastScript
I want to use the fastscript component on c++builder6.0.

how I can add the "AddMethod function" of fastscript component on cbuilder?

I tried it but it created some errors.

if you can solve this problem I will be glad.


Variant TForm1::CallMethod(TObject Instance,TMetaClass* ClassType , const String MethodName,Variant& Params)
{

//...
//...
return 1;
}

int TForm1::cBFunc(int x)
{

ShowMessage("ok");
return 0;
}

example:
fsScript1->AddMethod("int CBFunc(int x)", CallMethod);

Build Error:

[C++ Error] Unit1.cpp(83): E2034 Cannot convert 'Variant (* (_closure
)(TObject,TMetaClass *,const AnsiString,Variant &))(TObject,TMetaClass
*,const AnsiString,Variant &)' to 'Variant (_fastcall * (_closure
)(TObject *,TMetaClass *,const AnsiString,Variant &))(TObject *,TMetaClass
*,const AnsiString,Variant &)'
[C++ Error] Unit1.cpp(83): E2342 Type mismatch in parameter
'CallEvent' (wanted 'Variant (_fastcall * (_closure )(TObject *,TMetaClass
*,const AnsiString,Variant &))(TObject *,TMetaClass *,const
AnsiString,Variant &)', got 'void')

Comments

  • the function prototype is:

    Variant __fastcall ScriptFunction(TObject *pInstance, TClass ClassType, const AnsiString MethodName, Variant &Params);

    declare this in the "__published" section of the class defintion in the header file.

    This should work - I use BCB5, and this is how I got it working.

    Hope this helps
  • edited 2:18AM
    See my last reply in the post "Return Values to script methods". If you are still having trouble, e-mail me and I'll send you my code.

    John

Leave a Comment