.. _stdlib_cpp_bind: ====================== C++ 绑定生成器 ====================== .. include:: detail/cpp_bind.rst cpp_bind 模块实现 Daslang 接口的 C++ 绑定生成。 所有函数和符号都在 “cpp_bind” 模块中,使用 require 来访问它。 :: require daslib/cpp_bind 例如,来自 tutorial04.das:: require fio require ast require daslib/cpp_bind [init] def generate_cpp_bindings let root = get_das_root() + "/examples/tutorial/" fopen(root + "tutorial04_gen.inc","wb") <| $ ( cpp_file ) log_cpp_class_adapter(cpp_file, "TutorialBaseClass", typeinfo(ast_typedecl type)) ++++++++++++++++++++++ 生成绑定 ++++++++++++++++++++++ * :ref:`log_cpp_class_adapter (cpp_file:fio::FILE const? const;name:string const;cinfo:smart_ptr\ const) : void ` .. _function-_at_cpp_bind_c__c_log_cpp_class_adapter_CY_ls_file_gr_1_ls_CH_ls_fio_c__c_FILE_gr__gr__qm__Cs_CY_ls_TypeDeclPtr_gr_1_ls_H_ls_ast_c__c_TypeDecl_gr__gr__qm_M: .. das:function:: log_cpp_class_adapter(cpp_file: file; name: string const; cinfo: TypeDeclPtr) +--------+----------------------------------------+ +argument+argument type + +========+========================================+ +cpp_file+ :ref:`file ` + +--------+----------------------------------------+ +name +string const + +--------+----------------------------------------+ +cinfo + :ref:`TypeDeclPtr ` + +--------+----------------------------------------+ 为 Daslang 类生成 C++ 类适配器。 有可能的使用:: log_cpp_class_adapter(cppFileNameDotInc, "daslangClassName", typeinfo(ast_typedecl type)) get invoke