如何用pyd包装Python的D类?

如何用pyd包装Python的D类?,d,D,我正在尝试包装一个类,并遵循包装中的示例 这是我正在使用的外部块: extern(C) void PydMain() { alias document = dstring[]; def!(get_salt)(); wrap_class!( HashCorpus, Init!(document[], string, string, string, uint), )(); module_init(

我正在尝试包装一个类,并遵循包装中的示例

这是我正在使用的外部块:

extern(C) void PydMain() {
    alias document = dstring[];
    def!(get_salt)();
    wrap_class!(
            HashCorpus,
            Init!(document[], string, string, string, uint),
            )();
    module_init();
}
这是我得到的编译错误:

/usr/local/lib/python3.5/dist-packages/pyd/infrastructure/pyd/class_wrap.d(526): Error: tuple index 0 exceeds 0
/usr/local/lib/python3.5/dist-packages/pyd/infrastructure/pyd/class_wrap.d(534): Error: template instance pyd.class_wrap.Init!(dstring[][], string, string, string, uint).Init.Inner!(HashCorpus) error instantiating
/usr/local/lib/python3.5/dist-packages/pyd/infrastructure/pyd/make_wrapper.d(127):        instantiated from here: shim!(0LU, HashCorpus)
/usr/local/lib/python3.5/dist-packages/pyd/infrastructure/pyd/make_wrapper.d(137):        instantiated from here: class_decls!(0u, HashCorpus, Init!(dstring[][], string, string, string, uint))
/usr/local/lib/python3.5/dist-packages/pyd/infrastructure/pyd/class_wrap.d(1483):        instantiated from here: make_wrapper!(HashCorpus, Init!(dstring[][], string, string, string, uint))
/usr/local/lib/python3.5/dist-packages/pyd/infrastructure/pyd/class_wrap.d(1476):        instantiated from here: _wrap_class!(HashCorpus, "HashCorpus", "", "", Init!(dstring[][], string, string, string, uint))
source/corpushash/hashers.d(207):        instantiated from here: wrap_class!(HashCorpus, Init!(dstring[][], string, string, string, uint))
我举这个例子:


我正在使用dmd编译器。

通过浏览示例文件夹,看起来您必须使用
module_init()
在任何
wrap_类之前
。我尝试了两种方法,之前和之后,结果都是一样的。