MiniD 2 - Tentative Release Candidate 1

mpt foo at invalid.x
Mon Dec 8 00:44:49 PST 2008


Great stuff, but I have some trouble with the binding lib.

1. If I don't wrap a constructor, I get an error:
minid/bind.d(1101): static assert  "Cannot call default constructor for class Foo; please wrap a constructor explicitly"

2. If I wrap a constructor with no parameters (i.e. WrapCtors!(void function())), I get an error:
minid/bind.d(1066): constructor minid.bind.WrappedClass!(Foo,"Foo","",WrapCtors!(void function()),WrapMethod!(Call)).WrappedClass.ClassCtorShims!(void function()).this (MDVM*,()) does not match parameter types ()
minid/bind.d(1066): Error: expected 1 arguments, not 0

3. I can't find an obvious way to initialize global variables, so I try superPush, which gives a runtime error:
minid.types.MDException: <no location available>: newInstance - expected 'class' for base, not 'null'

Test code below:

import minid.bind;
import minid.api;

class Foo {
    this() {}
    this(int i) {}
    void Call() {}
}

void main() {
    MDVM vm;
    auto t = openVM(&vm);
    loadStdlibs(t);
    WrapGlobals!(
        WrapType!(
            Foo, "Foo",
            WrapCtors!(void function(int)),
            WrapMethod!(Foo.Call)
        )
    )(t);
    superPush(t, new Foo());
    newGlobal(t, "myfoo");
}




More information about the Digitalmars-d-announce mailing list