Lablqt. Some problems
Dec. 10th, 2011 03:16 pmNow I have problems with implementing inheritance in lablqt. The problem is in abstract (in terms of C++) classes. If I make for every abstract in C++ class virtual OCaml class, then I can't wrap methods which uses this abstract class as a parameter. For example, this is a part of code
In OCaml this method has sugnature
Now we can formulate a problem: how to implement methods, where one of the arguments is virtual class in OCaml?
//void paintEvent(QPaintEvent* e) declared in QAbstractButton
void paintEvent(QPaintEvent* arg0) {
CAMLparam0();
::CAMLlocal2(camlobj,meth);
printf("Calling QAbstractButton::paintEvent of object = %p\n",this);
GET_CAML_OBJECT(this,the_caml_object)
camlobj = (::value) the_caml_object;
meth = caml_get_public_method( camlobj, caml_hash_variant("paintEvent"));
assert(meth!=0);
::value *args = new ::value[2]; // TODO: use CAMLlocalN macros
args[0] = camlobj;
setAbstrClass< QPaintEvent>(args[1],arg0);
::value *call_helper=caml_named_value("make_QPaintEvent"); // look at this line.
assert(call_helper != 0);
args[1]=caml_callback(*call_helper,args[1]); }
// delete args or not?
caml_callbackN(meth, 2, args);;
CAMLreturn0;
}In OCaml this method has sugnature
method paintEvent : qPaintEvent -> unitand I should construct OCaml class and send it as 1st arguments of method paintEvent. Hence, I should have access to constructor values from C++.
Now we can formulate a problem: how to implement methods, where one of the arguments is virtual class in OCaml?