diff --git a/CMakeLists.txt b/CMakeLists.txt index d07d16c..eae74fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,8 +24,10 @@ endif() # Plugify # set(PLUGIFY_BUILD_SHARED_LIB ON CACHE INTERNAL "") -set(PLUGIFY_BUILD_FUNCTION ON CACHE INTERNAL "") +set(PLUGIFY_BUILD_JIT ON CACHE INTERNAL "") set(PLUGIFY_BUILD_ASSEMBLY ON CACHE INTERNAL "") +set(PLUGIFY_BUILD_TESTS OFF CACHE INTERNAL "") +set(PLUGIFY_DOWNLOADER OFF CACHE INTERNAL "") if(LINUX) set(PLUGIFY_USE_STATIC_STDLIB ON CACHE INTERNAL "") endif() @@ -40,12 +42,12 @@ include(cmake/dyncall.cmake) # Go Language Module for Plugify # file(GLOB_RECURSE GOLM_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.cpp") -set(GOLM_PCH_FILE "src/pch.h") +set(GOLM_PCH_FILE "src/pch.hpp") add_library(${PROJECT_NAME} SHARED ${GOLM_SOURCES}) target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include) -set(GOLM_LINK_LIBRARIES plugify::plugify plugify::plugify-assembly asmjit::asmjit dyncall_s dyncallback_s) +set(GOLM_LINK_LIBRARIES plugify::plugify plugify::plugify-assembly plugify::plugify-jit asmjit::asmjit dyncall_s) if(NOT COMPILER_SUPPORTS_FORMAT) set(GOLM_LINK_LIBRARIES ${GOLM_LINK_LIBRARIES} fmt::fmt-header-only) diff --git a/external/plugify b/external/plugify index 7060a96..6a2bd80 160000 --- a/external/plugify +++ b/external/plugify @@ -1 +1 @@ -Subproject commit 7060a966335407af6d6b68640e4ce9fe2f202afe +Subproject commit 6a2bd80d24b317f15c38c103dd57b17f06be427d diff --git a/generator/generator.py b/generator/generator.py index df8c0bf..c52b202 100644 --- a/generator/generator.py +++ b/generator/generator.py @@ -23,22 +23,22 @@ 'float': 'float', 'double': 'double', 'function': 'delegate', - 'string': 'void*', - 'bool*': 'void*', - 'char8*': 'void*', - 'char16*': 'void*', - 'int8*': 'void*', - 'int16*': 'void*', - 'int32*': 'void*', - 'int64*': 'void*', - 'uint8*': 'void*', - 'uint16*': 'void*', - 'uint32*': 'void*', - 'uint64*': 'void*', - 'ptr64*': 'void*', - 'float*': 'void*', - 'double*': 'void*', - 'string*': 'void*', + 'string': 'String*', + 'bool*': 'Vector*', + 'char8*': 'Vector*', + 'char16*': 'Vector*', + 'int8*': 'Vector*', + 'int16*': 'Vector*', + 'int32*': 'Vector*', + 'int64*': 'Vector*', + 'uint8*': 'Vector*', + 'uint16*': 'Vector*', + 'uint32*': 'Vector*', + 'uint64*': 'Vector*', + 'ptr64*': 'Vector*', + 'float*': 'Vector*', + 'double*': 'Vector*', + 'string*': 'Vector*', 'vec2': 'Vector2*', 'vec3': 'Vector3*', 'vec4': 'Vector4*', @@ -62,22 +62,22 @@ 'float': 'float*', 'double': 'double*', 'function': 'delegate', - 'string': 'void*', - 'bool*': 'void*', - 'char8*': 'void*', - 'char16*': 'void*', - 'int8*': 'void*', - 'int16*': 'void*', - 'int32*': 'void*', - 'int64*': 'void*', - 'uint8*': 'void*', - 'uint16*': 'void*', - 'uint32*': 'void*', - 'uint64*': 'void*', - 'ptr64*': 'void*', - 'float*': 'void*', - 'double*': 'void*', - 'string*': 'void*', + 'string': 'String*', + 'bool*': 'Vector*', + 'char8*': 'Vector*', + 'char16*': 'Vector*', + 'int8*': 'Vector*', + 'int16*': 'Vector*', + 'int32*': 'Vector*', + 'int64*': 'Vector*', + 'uint8*': 'Vector*', + 'uint16*': 'Vector*', + 'uint32*': 'Vector*', + 'uint64*': 'Vector*', + 'ptr64*': 'Vector*', + 'float*': 'Vector*', + 'double*': 'Vector*', + 'string*': 'Vector*', 'vec2': 'Vector2*', 'vec3': 'Vector3*', 'vec4': 'Vector4*', @@ -101,22 +101,22 @@ 'float': 'float', 'double': 'double', 'function': 'delegate', - 'string': 'void', - 'bool*': 'void', - 'char8*': 'void', - 'char16*': 'void', - 'int8*': 'void', - 'int16*': 'void', - 'int32*': 'void', - 'int64*': 'void', - 'uint8*': 'void', - 'uint16*': 'void', - 'uint32*': 'void', - 'uint64*': 'void', - 'ptr64*': 'void', - 'float*': 'void', - 'double*': 'void', - 'string*': 'void', + 'string': 'String', + 'bool*': 'Vector', + 'char8*': 'Vector', + 'char16*': 'Vector', + 'int8*': 'Vector', + 'int16*': 'Vector', + 'int32*': 'Vector', + 'int64*': 'Vector', + 'uint8*': 'Vector', + 'uint16*': 'Vector', + 'uint32*': 'Vector', + 'uint64*': 'Vector', + 'ptr64*': 'Vector', + 'float*': 'Vector', + 'double*': 'Vector', + 'string*': 'Vector', 'vec2': 'Vector2', 'vec3': 'Vector3', 'vec4': 'Vector4', @@ -257,66 +257,28 @@ 'float': 'C.float', 'double': 'C.double', 'function': '', - 'string': 'C.Plugify_CreateString', - 'bool*': 'C.Plugify_CreateVectorC.BOOL', - 'char8*': 'C.Plugify_CreateVectorC.CHAR8', - 'char16*': 'C.Plugify_CreateVectorC.CHAR16', - 'int8*': 'C.Plugify_CreateVectorC.INT8', - 'int16*': 'C.Plugify_CreateVectorC.INT16', - 'int32*': 'C.Plugify_CreateVectorC.INT32', - 'int64*': 'C.Plugify_CreateVectorC.INT64', - 'uint8*': 'C.Plugify_CreateVectorC.UINT8', - 'uint16*': 'C.Plugify_CreateVectorC.UINT16', - 'uint32*': 'C.Plugify_CreateVectorC.UINT32', - 'uint64*': 'C.Plugify_CreateVectorC.UINT64', - 'ptr64*': 'C.Plugify_CreateVectorC.POINTER', - 'float*': 'C.Plugify_CreateVectorC.FLOAT', - 'double*': 'C.Plugify_CreateVectorC.DOUBLE', - 'string*': 'C.Plugify_CreateVectorC.STRING', + 'string': 'C.Plugify_ConstructString', + 'bool*': 'C.Plugify_ConstructVectorC.BOOL', + 'char8*': 'C.Plugify_ConstructVectorC.CHAR8', + 'char16*': 'C.Plugify_ConstructVectorC.CHAR16', + 'int8*': 'C.Plugify_ConstructVectorC.INT8', + 'int16*': 'C.Plugify_ConstructVectorC.INT16', + 'int32*': 'C.Plugify_ConstructVectorC.INT32', + 'int64*': 'C.Plugify_ConstructVectorC.INT64', + 'uint8*': 'C.Plugify_ConstructVectorC.UINT8', + 'uint16*': 'C.Plugify_ConstructVectorC.UINT16', + 'uint32*': 'C.Plugify_ConstructVectorC.UINT32', + 'uint64*': 'C.Plugify_ConstructVectorC.UINT64', + 'ptr64*': 'C.Plugify_ConstructVectorC.POINTER', + 'float*': 'C.Plugify_ConstructVectorC.FLOAT', + 'double*': 'C.Plugify_ConstructVectorC.DOUBLE', + 'string*': 'C.Plugify_ConstructVectorC.STRING', 'vec2': 'C.Vector2', 'vec3': 'C.Vector3', 'vec4': 'C.Vector4', 'mat4x4': 'C.Matrix4x4' } -RET_GOTYPESCAST_MAP = { - 'void': '', - 'bool': 'C.bool', - 'char8': 'C.char', - 'char16': 'C.uint16_t', - 'int8': 'C.int8_t', - 'int16': 'C.int16_t', - 'int32': 'C.int32_t', - 'int64': 'C.int64_t', - 'uint8': 'C.uint8_t', - 'uint16': 'C.uint16_t', - 'uint32': 'C.uint32_t', - 'uint64': 'C.uint64_t', - 'ptr64': 'C.uintptr_t', - 'float': 'C.float', - 'double': 'C.double', - 'function': '', - 'string': 'C.Plugify_AllocateString', - 'bool*': 'C.Plugify_AllocateVectorC.BOOL', - 'char8*': 'C.Plugify_AllocateVectorC.CHAR8', - 'char16*': 'C.Plugify_AllocateVectorC.CHAR16', - 'int8*': 'C.Plugify_AllocateVectorC.INT8', - 'int16*': 'C.Plugify_AllocateVectorC.INT16', - 'int32*': 'C.Plugify_AllocateVectorC.INT32', - 'int64*': 'C.Plugify_AllocateVectorC.INT64', - 'uint8*': 'C.Plugify_AllocateVectorC.UINT8', - 'uint16*': 'C.Plugify_AllocateVectorC.UINT16', - 'uint32*': 'C.Plugify_AllocateVectorC.UINT32', - 'uint64*': 'C.Plugify_AllocateVectorC.UINT64', - 'ptr64*': 'C.Plugify_AllocateVectorC.POINTER', - 'float*': 'C.Plugify_AllocateVectorC.FLOAT', - 'double*': 'C.Plugify_AllocateVectorC.DOUBLE', - 'string*': 'C.Plugify_AllocateVectorC.STRING', - 'vec2': 'C.Vector2', - 'vec3': 'C.Vector3', - 'vec4': 'C.Vector4', - 'mat4x4': 'C.Matrix4x4' -} DEL_GOTYPESCAST_MAP = { 'void': '', @@ -335,61 +297,22 @@ 'float': '', 'double': '', 'function': '', - 'string': 'C.Plugify_DeleteString', - 'bool*': 'C.Plugify_DeleteVectorC.BOOL', - 'char8*': 'C.Plugify_DeleteVectorC.CHAR8', - 'char16*': 'C.Plugify_DeleteVectorC.CHAR16', - 'int8*': 'C.Plugify_DeleteVectorC.INT8', - 'int16*': 'C.Plugify_DeleteVectorC.INT16', - 'int32*': 'C.Plugify_DeleteVectorC.INT32', - 'int64*': 'C.Plugify_DeleteVectorC.INT64', - 'uint8*': 'C.Plugify_DeleteVectorC.UINT8', - 'uint16*': 'C.Plugify_DeleteVectorC.UINT16', - 'uint32*': 'C.Plugify_DeleteVectorC.UINT32', - 'uint64*': 'C.Plugify_DeleteVectorC.UINT64', - 'ptr64*': 'C.Plugify_DeleteVectorC.POINTER', - 'float*': 'C.Plugify_DeleteVectorC.FLOAT', - 'double*': 'C.Plugify_DeleteVectorC.DOUBLE', - 'string*': 'C.Plugify_DeleteVectorC.STRING', - 'vec2': '', - 'vec3': '', - 'vec4': '', - 'mat4x4': '' -} - -FRE_GOTYPESCAST_MAP = { - 'void': '', - 'bool': '', - 'char8': '', - 'char16': '', - 'int8': '', - 'int16': '', - 'int32': '', - 'int64': '', - 'uint8': '', - 'uint16': '', - 'uint32': '', - 'uint64': '', - 'ptr64': '', - 'float': '', - 'double': '', - 'function': '', - 'string': 'C.Plugify_FreeString', - 'bool*': 'C.Plugify_FreeVectorC.BOOL', - 'char8*': 'C.Plugify_FreeVectorC.CHAR8', - 'char16*': 'C.Plugify_FreeVectorC.CHAR16', - 'int8*': 'C.Plugify_FreeVectorC.INT8', - 'int16*': 'C.Plugify_FreeVectorC.INT16', - 'int32*': 'C.Plugify_FreeVectorC.INT32', - 'int64*': 'C.Plugify_FreeVectorC.INT64', - 'uint8*': 'C.Plugify_FreeVectorC.UINT8', - 'uint16*': 'C.Plugify_FreeVectorC.UINT16', - 'uint32*': 'C.Plugify_FreeVectorC.UINT32', - 'uint64*': 'C.Plugify_FreeVectorC.UINT64', - 'ptr64*': 'C.Plugify_FreeVectorC.POINTER', - 'float*': 'C.Plugify_FreeVectorC.FLOAT', - 'double*': 'C.Plugify_FreeVectorC.DOUBLE', - 'string*': 'C.Plugify_FreeVectorC.STRING', + 'string': 'C.Plugify_DestroyString', + 'bool*': 'C.Plugify_DestroyVectorC.BOOL', + 'char8*': 'C.Plugify_DestroyVectorC.CHAR8', + 'char16*': 'C.Plugify_DestroyVectorC.CHAR16', + 'int8*': 'C.Plugify_DestroyVectorC.INT8', + 'int16*': 'C.Plugify_DestroyVectorC.INT16', + 'int32*': 'C.Plugify_DestroyVectorC.INT32', + 'int64*': 'C.Plugify_DestroyVectorC.INT64', + 'uint8*': 'C.Plugify_DestroyVectorC.UINT8', + 'uint16*': 'C.Plugify_DestroyVectorC.UINT16', + 'uint32*': 'C.Plugify_DestroyVectorC.UINT32', + 'uint64*': 'C.Plugify_DestroyVectorC.UINT64', + 'ptr64*': 'C.Plugify_DestroyVectorC.POINTER', + 'float*': 'C.Plugify_DestroyVectorC.FLOAT', + 'double*': 'C.Plugify_DestroyVectorC.DOUBLE', + 'string*': 'C.Plugify_DestroyVectorC.STRING', 'vec2': '', 'vec3': '', 'vec4': '', @@ -452,22 +375,22 @@ 'float': '', 'double': '', 'function': '', - 'string': '', - 'bool*': '', - 'char8*': '', - 'char16*': '', - 'int8*': '', - 'int16*': '', - 'int32*': '', - 'int64*': '', - 'uint8*': '', - 'uint16*': '', - 'uint32*': '', - 'uint64*': '', - 'ptr64*': '', - 'float*': '', - 'double*': '', - 'string*': '', + 'string': '&', + 'bool*': '&', + 'char8*': '&', + 'char16*': '&', + 'int8*': '&', + 'int16*': '&', + 'int32*': '&', + 'int64*': '&', + 'uint8*': '&', + 'uint16*': '&', + 'uint32*': '&', + 'uint64*': '&', + 'ptr64*': '&', + 'float*': '&', + 'double*': '&', + 'string*': '&', 'vec2': '&', 'vec3': '&', 'vec4': '&', @@ -521,7 +444,7 @@ class ParamGen(Enum): TypesNames = 3 -def gen_params_string(method, param_gen: ParamGen): +def gen_params(method, param_gen: ParamGen): def gen_param(param): if param_gen == ParamGen.Types: type = convert_type(param['type'], 'ref' in param and param['ref'] is True, False) @@ -542,12 +465,7 @@ def gen_return(param): output_string = '' ret_type = method['retType'] - is_obj_ret = is_obj_return(ret_type["type"]) - if is_obj_ret: - output_string += f'{gen_return(ret_type)}' if method["paramTypes"]: - if is_obj_ret: - output_string += ', ' it = iter(method["paramTypes"]) output_string += gen_param(next(it)) for p in it: @@ -555,7 +473,7 @@ def gen_return(param): return output_string -def gen_goparams_string(method, param_gen: ParamGen): +def gen_goparams(method, param_gen: ParamGen): def gen_param(param): type = convert_gotype(param['type'], 'ref' in param and param['ref'] is True, False) if param_gen == ParamGen.Types: @@ -586,9 +504,6 @@ def gen_return(param): output_string = '' ret_type = method['retType'] - is_obj_ret = is_obj_return(ret_type["type"]) - if is_obj_ret: - output_string += f'{gen_return(ret_type)}' if method["paramTypes"]: it = iter(method["paramTypes"]) output_string += gen_param(next(it)) @@ -597,10 +512,10 @@ def gen_return(param): return output_string -def gen_goparamscast_string(method): +def gen_goparamscast(method): def gen_param(param): type = VAL_GOTYPESCAST_MAP.get(param['type'], 'int') - if 'CreateVector' in type: + if 'ConstructVector' in type: if 'ref' in param and param['ref'] is True: output = f'var A_{param['name']} unsafe.Pointer\n' output += f'\tS_{param['name']} := len(*{param['name']})\n' @@ -609,7 +524,7 @@ def gen_param(param): output += '\t} else {\n' output += f'\t\tA_{param['name']} = nil\n' output += '\t}\n' - output += f'\tC_{param['name']} := {type[:22]}(A_{param['name']}, C.ptrdiff_t(S_{param['name']}), {type[22:]})' + output += f'\tC_{param['name']} := {type[:25]}(A_{param['name']}, C.ptrdiff_t(S_{param['name']}), {type[25:]})' return output; else: output = f'var A_{param['name']} unsafe.Pointer\n' @@ -619,9 +534,9 @@ def gen_param(param): output += '\t} else {\n' output += f'\t\tA_{param['name']} = nil\n' output += '\t}\n' - output += f'\tC_{param['name']} := {type[:22]}(A_{param['name']}, C.ptrdiff_t(S_{param['name']}), {type[22:]})' + output += f'\tC_{param['name']} := {type[:25]}(A_{param['name']}, C.ptrdiff_t(S_{param['name']}), {type[25:]})' return output; - elif 'CreateString' in type: + elif 'ConstructString' in type: if 'ref' in param and param['ref'] is True: return f'C_{param['name']} := {type}(*{param['name']})' else: @@ -643,17 +558,10 @@ def gen_param(param): return f'C_{param['name']} := {type}({param['name']})' def gen_return(param): - type = RET_GOTYPESCAST_MAP.get(param['type'], 'int') - if 'C.Vector' in type or 'C.Matrix' in type: - return f'C_output := {type}' + "{}" - else: - return f'C_output := {type[:24]}({type[24:]})' + return '' output_string = '' ret_type = method['retType'] - is_obj_ret = is_obj_return(ret_type["type"]) - if is_obj_ret: - output_string += f'{gen_return(ret_type)}' if method["paramTypes"]: it = iter(method["paramTypes"]) output_string += f'{gen_param(next(it))}\n' @@ -662,26 +570,24 @@ def gen_return(param): return output_string -def gen_goparamscast_assign_string(method): +def gen_goparamscast_assign(method): def gen_param(param): if 'ref' in param and param['ref'] is True: type = ASS_GOTYPESCAST_MAP.get(param['type'], 'int') if type == 'C.GoString': - output = f'P_{param['name']} := C.Plugify_GetStringData(C_{param['name']})\n' + output = f'P_{param['name']} := C.Plugify_GetStringData(&C_{param['name']})\n' output += f'\t*{param['name']} = {type}(P_{param['name']})' return output elif 'C.Vector' in type or 'C.Matrix' in type: return f'*{param['name']} = *(*{type[2:]})(unsafe.Pointer(&C_{param['name']}))' elif 'C.' in type or type[0] == '*' or type == 'string': - name = f'C_{param['name']}' + name = f'&C_{param['name']}' mode = '' - if param['type'] == 'bool*': - mode = 'Bool' - elif param['type'] == 'string*': + if param['type'] == 'string*': mode = 'CStr' go_type = VAL_GOTYPES_MAP.get(param['type'], 'int')[2:] - val_type = VAL_GOTYPESCAST_MAP.get(param['type'], 'int')[22:] + val_type = VAL_GOTYPESCAST_MAP.get(param['type'], 'int')[25:] output = f'L_{param['name']} := C.Plugify_GetVectorSize({name}, {val_type})\n' output += f'\tP_{param['name']} := C.Plugify_GetVectorData({name}, {val_type})\n' #output += f'\t*{param['name']} = unsafe.Slice((*{go_type})(P_{param['name']}), L_{param['name']})' @@ -692,7 +598,7 @@ def gen_param(param): else: output += f'\t\t(*{param['name']})[i] = *(*{go_type})(unsafe.Pointer(uintptr(P_{param['name']}) + uintptr(i * C.sizeof_{type[2:]})))\n' output += "\t}" - if mode == 'Bool' or mode == 'CStr': + if mode == 'CStr': output += f'\n\tC.Plugify_DeleteVectorData{mode}(P_{param['name']})' return output else: @@ -703,20 +609,18 @@ def gen_param(param): def gen_return(param): type = ASS_GOTYPESCAST_MAP.get(param['type'], 'int') if type == 'C.GoString': - output = f'P_output := C.Plugify_GetStringData(C_output)\n' + output = f'P_output := C.Plugify_GetStringData(&C_output)\n' output += f'\toutput := {type}(P_output)' return output elif 'C.Vector' in type or 'C.Matrix' in type: return f'output := *(*{type[2:]})(unsafe.Pointer(&C_output))' elif 'C.' in type or type[0] == '*' or type == 'string': - name = f'C_output' + name = f'&C_output' mode = '' - if param['type'] == 'bool*': - mode = 'Bool' - elif param['type'] == 'string*': + if param['type'] == 'string*': mode = 'CStr' go_type = VAL_GOTYPES_MAP.get(param['type'], 'int')[2:] - val_type = VAL_GOTYPESCAST_MAP.get(param['type'], 'int')[22:] + val_type = VAL_GOTYPESCAST_MAP.get(param['type'], 'int')[25:] output = f'L_output := C.Plugify_GetVectorSize({name}, {val_type})\n' output += f'\tP_output := C.Plugify_GetVectorData({name}, {val_type})\n' #output += f'\toutput := unsafe.Slice((*{go_type})(P_output), L_output)' @@ -727,7 +631,7 @@ def gen_return(param): else: output += f'\t\toutput[i] = *(*{go_type})(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_{type[2:]})))\n' output += "\t}\n" - if mode == 'Bool' or mode == 'CStr': + if mode == 'CStr': output += f'\n\tC.Plugify_DeleteVectorData{mode}(P_output)' return output else: @@ -750,24 +654,24 @@ def gen_return(param): return output_string -def gen_goparamscast_cleanup_string(method): +def gen_goparamscast_cleanup(method): def gen_param(param): type = DEL_GOTYPESCAST_MAP.get(param['type'], 'int') if type == '': return type - elif 'DeleteVector' in type: - return f'{type[:22]}(C_{param['name']}, {type[22:]})' + elif 'DestroyVector' in type: + return f'{type[:23]}(&C_{param['name']}, {type[23:]})' else: - return f'{type}(C_{param['name']})' + return f'{type}(&C_{param['name']})' def gen_return(param): - type = FRE_GOTYPESCAST_MAP.get(param['type'], 'int') + type = DEL_GOTYPESCAST_MAP.get(param['type'], 'int') if type == '': return type - elif 'FreeVector' in type: - return f'{type[:20]}(C_output, {type[20:]})' + elif 'DestroyVector' in type: + return f'{type[:23]}(&C_output, {type[23:]})' else: - return f'{type}(C_output)' + return f'{type}(&C_output)' output_string = '' ret_type = method['retType'] @@ -814,75 +718,70 @@ def main(manifest_path, output_dir, override): print(f' {error}') return 1 - content = '#pragma once\n' - content += '#include \n' - content += '#include \n' - content += '#include \n\n' - content += 'enum DataType {\n' - content += '\tBOOL,\n' - content += '\tCHAR8,\n' - content += '\tCHAR16,\n' - content += '\tINT8,\n' - content += '\tINT16,\n' - content += '\tINT32,\n' - content += '\tINT64,\n' - content += '\tUINT8,\n' - content += '\tUINT16,\n' - content += '\tUINT32,\n' - content += '\tUINT64,\n' - content += '\tPOINTER,\n' - content += '\tFLOAT,\n' - content += '\tDOUBLE,\n' - content += '\tSTRING\n' - content += '};\n\n' - content += 'extern void* Plugify_GetMethodPtr(const char* methodName);\n' - content += 'extern void Plugify_GetMethodPtr2(const char* methodName, void** addressDest);\n' - content += '\n' - content += 'extern void* Plugify_AllocateString();\n' - content += 'extern void* Plugify_CreateString(_GoString_ source);\n' - content += 'extern const char* Plugify_GetStringData(void* ptr);\n' - content += 'extern ptrdiff_t Plugify_GetStringLength(void* ptr);\n' - content += 'extern void Plugify_AssignString(void* ptr, _GoString_ source);\n' - content += 'extern void Plugify_FreeString(void* ptr);\n' - content += 'extern void Plugify_DeleteString(void* ptr);\n' - content += '\n' - content += 'extern void* Plugify_CreateVector(void* arr, ptrdiff_t len, enum DataType type);\n' - content += 'extern void* Plugify_AllocateVector(enum DataType type);\n' - content += 'extern ptrdiff_t Plugify_GetVectorSize(void* ptr, enum DataType type);\n' - content += 'extern void* Plugify_GetVectorData(void* ptr, enum DataType type);\n' - content += 'extern void Plugify_AssignVector(void* ptr, void* arr, ptrdiff_t len, enum DataType type);\n' - content += 'extern void Plugify_DeleteVector(void* ptr, enum DataType type);\n' - content += 'extern void Plugify_FreeVector(void* ptr, enum DataType type);\n' - content += '\n' - content += 'extern void Plugify_DeleteVectorDataBool(void* ptr);\n' - content += 'extern void Plugify_DeleteVectorDataCStr(void* ptr);\n' - content += '\n' - content += 'extern void Plugify_SetGetMethodPtr(void* func);\n' - content += 'extern void Plugify_SetAllocateString(void* func);\n' - content += 'extern void Plugify_SetCreateString(void* func);\n' - content += 'extern void Plugify_SetGetStringData(void* func);\n' - content += 'extern void Plugify_SetGetStringLength(void* func);\n' - content += 'extern void Plugify_SetAssignString(void* func);\n' - content += 'extern void Plugify_SetFreeString(void* func);\n' - content += 'extern void Plugify_SetDeleteString(void* func);\n' - content += 'extern void Plugify_SetCreateVector(void* func);\n' - content += 'extern void Plugify_SetAllocateVector(void* func);\n' - content += 'extern void Plugify_SetGetVectorSize(void* func);\n' - content += 'extern void Plugify_SetGetVectorData(void* func);\n' - content += 'extern void Plugify_SetAssignVector(void* func);\n' - content += 'extern void Plugify_SetDeleteVector(void* func);\n' - content += 'extern void Plugify_SetFreeVector(void* func);\n' - content += '\n' - content += 'extern void Plugify_SetDeleteVectorDataBool(void* func);\n' - content += 'extern void Plugify_SetDeleteVectorDataCStr(void* func);\n' - content += '\n' - content += '//typedef struct { const char *p; ptrdiff_t n; } _GoString_;\n' - content += 'typedef struct { void *data; ptrdiff_t len; ptrdiff_t cap; } _GoSlice_;\n' - content += '\n' - content += 'typedef struct { float x, y; } Vector2;\n' - content += 'typedef struct { float x, y, z; } Vector3;\n' - content += 'typedef struct { float x, y, z, w; } Vector4;\n' - content += 'typedef struct { float m[4][4]; } Matrix4x4;\n' + content = ('#pragma once\n' + '#include \n' + '#include \n' + '#include \n\n' + 'enum DataType {\n' + '\tBOOL,\n' + '\tCHAR8,\n' + '\tCHAR16,\n' + '\tINT8,\n' + '\tINT16,\n' + '\tINT32,\n' + '\tINT64,\n' + '\tUINT8,\n' + '\tUINT16,\n' + '\tUINT32,\n' + '\tUINT64,\n' + '\tPOINTER,\n' + '\tFLOAT,\n' + '\tDOUBLE,\n' + '\tSTRING\n' + '};\n\n' + 'typedef struct { char* data; size_t size; size_t cap; } String;\n' + 'typedef struct { size_t size; size_t cap; void* data; } Vector;\n' + '\n' + 'extern void* Plugify_GetMethodPtr(const char* methodName);\n' + 'extern void Plugify_GetMethodPtr2(const char* methodName, void** addressDest);\n' + '\n' + 'extern String Plugify_ConstructString(_GoString_ source);\n' + 'extern void Plugify_DestroyString(String* string);\n' + 'extern const char* Plugify_GetStringData(String* string);\n' + 'extern ptrdiff_t Plugify_GetStringLength(String* string);\n' + 'extern void Plugify_AssignString(String* string, _GoString_ source);\n' + '\n' + 'extern Vector Plugify_ConstructVector(void* arr, ptrdiff_t len, enum DataType type);\n' + 'extern void Plugify_DestroyVector(Vector* vector, enum DataType type);\n' + 'extern void* Plugify_GetVectorData(Vector* vector, enum DataType type);\n' + 'extern ptrdiff_t Plugify_GetVectorSize(Vector* vector, enum DataType type);\n' + 'extern void Plugify_AssignVector(Vector* vector, void* arr, ptrdiff_t len, enum DataType type);\n' + '\n' + 'extern void Plugify_DeleteVectorDataCStr(void* arr);\n' + '\n' + 'extern void Plugify_SetGetMethodPtr(void* func);\n' + 'extern void Plugify_SetGetMethodPtr2(void* func);\n' + '\n' + 'extern void Plugify_SetConstructString(void* func);\n' + 'extern void Plugify_SetDestroyString(void* func);\n' + 'extern void Plugify_SetGetStringData(void* func);\n' + 'extern void Plugify_SetGetStringLength(void* func);\n' + 'extern void Plugify_SetAssignString(void* func);\n' + 'extern void Plugify_SetConstructVector(void* func);\n' + 'extern void Plugify_SetDestroyVector(void* func);\n' + 'extern void Plugify_SetGetVectorData(void* func);\n' + 'extern void Plugify_SetGetVectorSize(void* func);\n' + 'extern void Plugify_SetAssignVector(void* func);\n' + '\n' + 'extern void Plugify_SetDeleteVectorDataCStr(void* func);\n' + '\n' + '//typedef struct { const char *p; ptrdiff_t n; } _GoString_;\n' + 'typedef struct { void *data; ptrdiff_t len; ptrdiff_t cap; } _GoSlice_;\n' + '\n' + 'typedef struct { float x, y; } Vector2;\n' + 'typedef struct { float x, y, z; } Vector3;\n' + 'typedef struct { float x, y, z, w; } Vector4;\n' + 'typedef struct { float m[4][4]; } Matrix4x4;\n') content += '\n' @@ -891,62 +790,62 @@ def main(manifest_path, output_dir, override): return_type = convert_type(ret_type["type"], "ref" in ret_type, True) content += (f'typedef {return_type} ' - f'(*{method['name']}Fn)({gen_params_string(method, ParamGen.Types)});\n') - content += (f'static {return_type} ' - f'{method['name']}({gen_params_string(method, ParamGen.TypesNames)}) {{\n') - content += f'\tstatic {method['name']}Fn __func = NULL;\n' - content += f'\tif (__func == NULL) Plugify_GetMethodPtr2("{plugin_name}.{method['name']}", (void**)&__func);\n' - content += (f'\t{"return " if ret_type['type'] != 'void' else ""}' - f'__func({gen_params_string(method, ParamGen.Names)});\n') - content += '}\n' + f'(*{method['name']}Fn)({gen_params(method, ParamGen.Types)});\n' + f'static {return_type} ' + f'{method['name']}({gen_params(method, ParamGen.TypesNames)}) {{\n' + f'\tstatic {method['name']}Fn __func = NULL;\n' + f'\tif (__func == NULL) Plugify_GetMethodPtr2("{plugin_name}.{method['name']}", (void**)&__func);\n' + f'\t{"return " if ret_type['type'] != 'void' else ""}' + f'__func({gen_params(method, ParamGen.Names)});\n' + '}\n') header_cfile = os.path.join(header_dir, f'{plugin_name}.h') with open(header_cfile, 'w', encoding='utf-8') as fd: fd.write(content) - content = '' - link = 'https://github.com/untrustedmodders/plugify-module-cpp/blob/main/generator/generator.py' - content += f'package {plugin_name}\n' - content += '\n' - content += f'//generated with {link} from {plugin_name} \n' - content += '\n' - content += f'// #include "{plugin_name}.h"\n' - content += 'import "C"\n' - content += 'import "unsafe"\n' - content += '\n' - content += 'type Vector2 struct {\n\tX float32\n\tY float32\n}\n' - content += 'type Vector3 struct {\n\tX float32\n\tY float32\n\tZ float32\n}\n' - content += 'type Vector4 struct {\n\tX float32\n\tY float32\n\tZ float32\n\tW float32\n}\n' - content += 'type Matrix4x4 struct {\n\tM[4][4] float32\n}\n' - content += '\n' + content = (f'package {plugin_name}\n' + '\n' + f'//generated with {link} from {plugin_name} \n' + '\n' + f'// #include "{plugin_name}.h"\n' + 'import "C"\n' + 'import "unsafe"\n' + '\n' + 'type Vector2 struct {\n\tX float32\n\tY float32\n}\n' + 'type Vector3 struct {\n\tX float32\n\tY float32\n\tZ float32\n}\n' + 'type Vector4 struct {\n\tX float32\n\tY float32\n\tZ float32\n\tW float32\n}\n' + 'type Matrix4x4 struct {\n\tM[4][4] float32\n}\n' + '\n') for method in pplugin['exportedMethods']: ret_type = method['retType'] return_type = convert_gotype(ret_type["type"], "ref" in ret_type, True) content += (f'func ' - f'{method['name']}({gen_goparams_string(method, ParamGen.TypesNames)}) {return_type} {{\n') + f'{method['name']}({gen_goparams(method, ParamGen.TypesNames)}) {return_type} {{\n') - params = gen_goparamscast_string(method) + params = gen_goparamscast(method) if params != '': content += f'\t{params}\n' is_obj_ret = is_obj_return(ret_type["type"]) is_pod_ret = is_pod_return(ret_type["type"]) if is_pod_ret: - content += f'\tC_result := C.{method['name']}({gen_goparams_string(method, ParamGen.Names)})\n' - elif not is_obj_ret and ret_type['type'] != 'void': - content += f'\tresult := {return_type}(C.{method['name']}({gen_goparams_string(method, ParamGen.Names)}))\n' + content += f'\tC_result := C.{method['name']}({gen_goparams(method, ParamGen.Names)})\n' + elif is_obj_ret: + content += f'\tC_output := C.{method['name']}({gen_goparams(method, ParamGen.Names)})\n' + elif ret_type['type'] != 'void': + content += f'\tresult := {return_type}(C.{method['name']}({gen_goparams(method, ParamGen.Names)}))\n' else: - content += f'\tC.{method['name']}({gen_goparams_string(method, ParamGen.Names)})\n' + content += f'\tC.{method['name']}({gen_goparams(method, ParamGen.Names)})\n' - params = gen_goparamscast_assign_string(method) + params = gen_goparamscast_assign(method) if params != '': content += f'\n{params}' - params = gen_goparamscast_cleanup_string(method) + params = gen_goparamscast_cleanup(method) if params != '': content += f'\n{params}\n' diff --git a/src/module.cpp b/src/module.cpp index cbf5f14..b56d3e9 100644 --- a/src/module.cpp +++ b/src/module.cpp @@ -1,13 +1,13 @@ -#include "module.h" +#include "module.hpp" -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include @@ -56,7 +56,7 @@ namespace { return true; } - GoSlice* CreateGoSliceBool(const std::vector& source, ArgumentList& args, BoolHolder& holder) { + GoSlice* CreateGoSliceBool(const plg::vector& source, ArgumentList& args, BoolHolder& holder) { assert(args.size() != args.capacity() && "Resizing list will invalidate pointers!"); size_t N = source.size(); auto& boolArray = holder.emplace_back(std::make_unique(N)); @@ -68,7 +68,7 @@ namespace { return &slice; } - GoSlice* CreateGoSliceString(const std::vector& source, ArgumentList& args, StringHolder& holder) { + GoSlice* CreateGoSliceString(const plg::vector& source, ArgumentList& args, StringHolder& holder) { assert(args.size() != args.capacity() && "Resizing list will invalidate pointers!"); size_t N = source.size(); auto& strArray = holder.emplace_back(std::make_unique(N)); @@ -84,7 +84,7 @@ namespace { } template - GoSlice* CreateGoSlice(const std::vector& source, ArgumentList& args) { + GoSlice* CreateGoSlice(const plg::vector& source, ArgumentList& args) { assert(args.size() != args.capacity() && "Resizing list will invalidate pointers!"); auto size = static_cast(source.size()); auto& slice = args.emplace_back((void*)source.data(), size, size); @@ -111,23 +111,15 @@ namespace { } template - void CopyGoSliceToVector(const GoSlice& source, std::vector& dest) { - if (source.data == nullptr || source.len == 0) + void CopyGoSliceToVector(const GoSlice& source, plg::vector& dest) { + if (source.data == nullptr || source.len == 0) [[unlikely]] dest.clear(); else if (dest.data() != source.data) dest.assign(reinterpret_cast(source.data), reinterpret_cast(source.data) + static_cast(source.len)); } template<> - void CopyGoSliceToVector(const GoSlice& source, std::vector& dest) { - dest.resize(static_cast(source.len)); - for (size_t i = 0; i < dest.size(); ++i) { - dest[i] = reinterpret_cast(source.data)[i]; - } - } - - template<> - void CopyGoSliceToVector(const GoSlice& source, std::vector& dest) { + void CopyGoSliceToVector(const GoSlice& source, plg::vector& dest) { dest.resize(static_cast(source.len)); for (size_t i = 0; i < dest.size(); ++i) { const auto& str = reinterpret_cast(source.data)[i]; @@ -136,38 +128,26 @@ namespace { } void CopyGoStringToString(const GoString& source, plg::string& dest) { - if (source.p == nullptr || source.n == 0) + if (source.p == nullptr || source.n == 0) [[unlikely]] dest.clear(); else if (dest.data() != source.p) dest.assign(source.p, static_cast(source.n)); } template - void CopyGoSliceToVectorReturn(const GoSlice& source, std::vector& dest) { - if (source.data == nullptr || source.len == 0) - std::construct_at(&dest, std::vector()); + void CopyGoSliceToVectorReturn(const GoSlice& source, plg::vector& dest) { + if (source.data == nullptr || source.len == 0) [[unlikely]] + std::construct_at(&dest); else - std::construct_at(&dest, std::vector(reinterpret_cast(source.data), reinterpret_cast(source.data) + static_cast(source.len))); + std::construct_at(&dest, reinterpret_cast(source.data), reinterpret_cast(source.data) + static_cast(source.len)); } template<> - void CopyGoSliceToVectorReturn(const GoSlice& source, std::vector& dest) { - if (source.data == nullptr || source.len == 0) - std::construct_at(&dest, std::vector()); + void CopyGoSliceToVectorReturn(const GoSlice& source, plg::vector& dest) { + if (source.data == nullptr || source.len == 0) [[unlikely]] + std::construct_at(&dest); else { - std::construct_at(&dest, std::vector(static_cast(source.len))); - for (size_t i = 0; i < dest.size(); ++i) { - dest[i] = reinterpret_cast(source.data)[i]; - } - } - } - - template<> - void CopyGoSliceToVectorReturn(const GoSlice& source, std::vector& dest) { - if (source.data == nullptr || source.len == 0) - std::construct_at(&dest, std::vector()); - else { - std::construct_at(&dest, std::vector(static_cast(source.len))); + std::construct_at(&dest, static_cast(source.len)); for (size_t i = 0; i < dest.size(); ++i) { const auto& str = reinterpret_cast(source.data)[i]; dest[i].assign(str.p, static_cast(str.n)); @@ -176,14 +156,14 @@ namespace { } void CopyGoStringToStringReturn(const GoString& source, plg::string& dest) { - if (source.p == nullptr || source.n == 0) - std::construct_at(&dest, plg::string()); + if (source.p == nullptr || source.n == 0) [[unlikely]] + std::construct_at(&dest); else - std::construct_at(&dest, plg::string(source.p, static_cast(source.n))); + std::construct_at(&dest, source.p, static_cast(source.n)); } template - DCaggr* CreateDcAggr(AggrList& aggrs) { + DCaggr* CreateDcAggr(AggrList&) { static_assert(always_false_v, "CreateDcAggr specialization required"); return nullptr; } @@ -271,8 +251,6 @@ void GoLanguageModule::Shutdown() { _addresses.clear(); _assemblyMap.clear(); - DetectLeaks(); - _rt.reset(); _provider.reset(); } @@ -421,7 +399,6 @@ void GoLanguageModule::InternalCall(MethodRef method, MemAddr addr, const JitCal DCCallVM* vm = &s_vm(); dcReset(vm); - bool hasRet = ValueUtils::IsHiddenParam(retType); bool hasRefs = false; DCaggr* ag = nullptr; @@ -470,8 +447,8 @@ void GoLanguageModule::InternalCall(MethodRef method, MemAddr addr, const JitCal break; } - for (uint8_t i = hasRet, j = 0; i < count; ++i, ++j) { - const auto& param = paramProps[j]; + for (uint8_t i = 0; i < count; ++i) { + const auto& param = paramProps[i]; if (param.IsReference()) { switch (param.GetType()) { case ValueType::Bool: @@ -535,49 +512,49 @@ void GoLanguageModule::InternalCall(MethodRef method, MemAddr addr, const JitCal break; // GoSlice* case ValueType::ArrayBool: - dcArgPointer(vm, CreateGoSliceBool(*p->GetArgument*>(i), args, boolHolder)); + dcArgPointer(vm, CreateGoSliceBool(*p->GetArgument*>(i), args, boolHolder)); break; case ValueType::ArrayChar8: - dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayChar16: - dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayInt8: - dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayInt16: - dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayInt32: - dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayInt64: - dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayUInt8: - dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayUInt16: - dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayUInt32: - dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayUInt64: - dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayPointer: - dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayFloat: - dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayDouble: - dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgPointer(vm, CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayString: - dcArgPointer(vm, CreateGoSliceString(*p->GetArgument*>(i), args, stringHolder)); + dcArgPointer(vm, CreateGoSliceString(*p->GetArgument*>(i), args, stringHolder)); break; default: std::puts(LOG_PREFIX "Unsupported types!\n"); @@ -639,49 +616,49 @@ void GoLanguageModule::InternalCall(MethodRef method, MemAddr addr, const JitCal break; // GoSlice case ValueType::ArrayBool: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSliceBool(*p->GetArgument*>(i), args, boolHolder)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSliceBool(*p->GetArgument*>(i), args, boolHolder)); break; case ValueType::ArrayChar8: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayChar16: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayInt8: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayInt16: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayInt32: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayInt64: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayUInt8: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayUInt16: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayUInt32: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayUInt64: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayPointer: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayFloat: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayDouble: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSlice(*p->GetArgument*>(i), args)); break; case ValueType::ArrayString: - dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSliceString(*p->GetArgument*>(i), args, stringHolder)); + dcArgAggr(vm, CreateDcAggr(aggrs), CreateGoSliceString(*p->GetArgument*>(i), args, stringHolder)); break; default: std::puts(LOG_PREFIX "Unsupported types!\n"); @@ -772,171 +749,107 @@ void GoLanguageModule::InternalCall(MethodRef method, MemAddr addr, const JitCal ret->SetReturn(val); break; } - case ValueType::Vector2: { - Vector2 source; - dcCallAggr(vm, addr, ag, &source); - ret->SetReturn(source); - break; - } -#if GOLM_PLATFORM_WINDOWS - case ValueType::Vector3: { - auto* dest = p->GetArgument(0); - dcCallAggr(vm, addr, ag, dest); - ret->SetReturn(dest); - break; - } - case ValueType::Vector4: { - auto* dest = p->GetArgument(0); - dcCallAggr(vm, addr, ag, dest); - ret->SetReturn(dest); - break; - } -#else - case ValueType::Vector3: { - Vector3 source; - dcCallAggr(vm, addr, ag, &source); - ret->SetReturn(source); - break; - } - case ValueType::Vector4: { - Vector4 source; - dcCallAggr(vm, addr, ag, &source); - ret->SetReturn(source); - break; - } -#endif + case ValueType::Vector2: + case ValueType::Vector3: + case ValueType::Vector4: case ValueType::Matrix4x4: { - auto* dest = p->GetArgument(0); - dcCallAggr(vm, addr, ag, dest); - ret->SetReturn(dest); + dcCallAggr(vm, addr, ag, ret->GetReturnPtr()); break; } case ValueType::String: { - auto* dest = p->GetArgument(0); GoString source; dcCallAggr(vm, addr, ag, &source); - CopyGoStringToStringReturn(source, *dest); - ret->SetReturn(dest); + CopyGoStringToStringReturn(source, *reinterpret_cast(ret->GetReturnPtr())); break; } case ValueType::ArrayBool: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } case ValueType::ArrayChar8: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } case ValueType::ArrayChar16: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } case ValueType::ArrayInt8: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } case ValueType::ArrayInt16: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } case ValueType::ArrayInt32: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } case ValueType::ArrayInt64: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } case ValueType::ArrayUInt8: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } case ValueType::ArrayUInt16: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } case ValueType::ArrayUInt32: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } case ValueType::ArrayUInt64: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } case ValueType::ArrayPointer: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } case ValueType::ArrayFloat: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } case ValueType::ArrayDouble: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } case ValueType::ArrayString: { - auto* dest = p->GetArgument*>(0); GoSlice source; dcCallAggr(vm, addr, ag, &source); - CopyGoSliceToVectorReturn(source, *dest); - ret->SetReturn(dest); + CopyGoSliceToVectorReturn(source, *reinterpret_cast*>(ret->GetReturnPtr())); break; } default: @@ -947,65 +860,65 @@ void GoLanguageModule::InternalCall(MethodRef method, MemAddr addr, const JitCal if (argsCount != 0) { if (hasRefs) { - size_t k = 0; - for (uint8_t i = hasRet, j = 0; i < count; ++i, ++j) { - const auto& param = paramProps[j]; + size_t j = 0; + for (uint8_t i = 0; i < count; ++i) { + const auto& param = paramProps[i]; if (param.IsReference()) { switch (param.GetType()) { case ValueType::String: - CopyGoStringToString(*reinterpret_cast(&args[k++]), *p->GetArgument(i)); + CopyGoStringToString(*reinterpret_cast(&args[j++]), *p->GetArgument(i)); break; case ValueType::ArrayBool: - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; case ValueType::ArrayChar8: - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; case ValueType::ArrayChar16: - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; case ValueType::ArrayInt8: - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; case ValueType::ArrayInt16: - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; case ValueType::ArrayInt32: - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; case ValueType::ArrayInt64: - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; case ValueType::ArrayUInt8: - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; case ValueType::ArrayUInt16: - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; case ValueType::ArrayUInt32: - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; case ValueType::ArrayUInt64: - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; case ValueType::ArrayPointer: - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; case ValueType::ArrayFloat: - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; case ValueType::ArrayDouble: - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; case ValueType::ArrayString: { - CopyGoSliceToVector(args[k++], *p->GetArgument*>(i)); + CopyGoSliceToVector(args[j++], *p->GetArgument*>(i)); break; } default: break; } } - if (k == argsCount) + if (j == argsCount) break; } } @@ -1016,59 +929,6 @@ namespace golm { GoLanguageModule g_golm; } -using type_index = uint32_t; -inline type_index type_id_seq = 0; -template inline const type_index type_id = type_id_seq++; - -std::map g_numberOfMalloc = { }; -std::map g_numberOfAllocs = { }; - -std::string_view GetTypeName(type_index type) { - static std::map typeNameMap = { - {type_id, "String"}, - {type_id>, "VectorBool"}, - {type_id>, "VectorChar8"}, - {type_id>, "VectorChar16"}, - {type_id>, "VectorInt8"}, - {type_id>, "VectorInt16"}, - {type_id>, "VectorInt32"}, - {type_id>, "VectorInt64"}, - {type_id>, "VectorUInt8"}, - {type_id>, "VectorUInt16"}, - {type_id>, "VectorUInt32"}, - {type_id>, "VectorUInt64"}, - {type_id>, "VectorUIntPtr"}, - {type_id>, "VectorFloat"}, - {type_id>, "VectorDouble"}, - {type_id>, "VectorString"}, - {type_id, "BoolArray"}, - {type_id, "CString"}, - {type_id, "CStringArray"} - }; - auto it = typeNameMap.find(type); - if (it != typeNameMap.end()) { - return std::get(*it); - } - return "unknown"; -} - -void GoLanguageModule::DetectLeaks() { - for (const auto& [type, count] : g_numberOfMalloc) { - if (count > 0) { - g_golm._provider->Log(std::format(LOG_PREFIX "Memory leaks detected: {} allocations. Related to {}!", count, GetTypeName(type)), Severity::Error); - } - } - - for (const auto& [type, count] : g_numberOfAllocs) { - if (count > 0) { - g_golm._provider->Log(std::format(LOG_PREFIX "Memory leaks detected: {} allocations. Related to {}!", count, GetTypeName(type)), Severity::Error); - } - } - - g_numberOfMalloc.clear(); - g_numberOfAllocs.clear(); -} - MemAddr GetMethodPtr(const char* methodName) { return g_golm.GetNativeMethod(methodName); } @@ -1082,7 +942,6 @@ const char* GetBaseDir() { size_t size = source.length() + 1; char* dest = new char[size]; std::memcpy(dest, source.c_str(), size); - ++g_numberOfAllocs[type_id]; return dest; } @@ -1129,7 +988,6 @@ const char* GetPluginBaseDir(PluginRef plugin) { size_t size = source.length() + 1; char* dest = new char[size]; std::memcpy(dest, source.c_str(), size); - ++g_numberOfAllocs[type_id]; return dest; } @@ -1139,7 +997,6 @@ const char** GetPluginDependencies(PluginRef plugin) { for (size_t i = 0; i < dependencies.size(); ++i) { deps[i] = dependencies[i].GetName().data(); } - ++g_numberOfAllocs[type_id]; return deps; } @@ -1154,26 +1011,25 @@ const char* FindPluginResource(PluginRef plugin, const char* path) { size_t size = source.length() + 1; char* dest = new char[size]; std::memcpy(dest, source.c_str(), size); - ++g_numberOfAllocs[type_id]; return dest; } return ""; } + void DeleteCStr(const char* path) { delete path; - --g_numberOfAllocs[type_id]; - assert(g_numberOfAllocs[type_id] != -1); } -void* AllocateString() { - auto str = static_cast(std::malloc(sizeof(plg::string))); - ++g_numberOfMalloc[type_id]; - return str; +plugify::String ConstructString(GoString source) { + plugify::String ret; + if (source.n == 0 || source.p == nullptr) [[unlikely]] + std::construct_at(reinterpret_cast(&ret)); + else + std::construct_at(reinterpret_cast(&ret), source.p, static_cast(source.n)); + return ret; } -void* CreateString(GoString source) { - auto str = source.n == 0 || source.p == nullptr ? new plg::string() : new plg::string(source.p, static_cast(source.n)); - ++g_numberOfAllocs[type_id]; - return str; +void DestroyString(plg::string* string) { + string->~basic_string(); } const char* GetStringData(plg::string* string) { return string->c_str(); @@ -1181,31 +1037,14 @@ const char* GetStringData(plg::string* string) { ptrdiff_t GetStringLength(plg::string* string) { return static_cast(string->length()); } -void ConstructString(plg::string* string, GoString source) { - if (source.n == 0 || source.p == nullptr) - std::construct_at(string, plg::string()); - else - std::construct_at(string, plg::string(source.p, static_cast(source.n))); -} void AssignString(plg::string* string, GoString source) { - if (source.p == nullptr || source.n == 0) + if (source.p == nullptr || source.n == 0) [[unlikely]] string->clear(); else string->assign(source.p, static_cast(source.n)); } -void FreeString(plg::string* string) { - string->~basic_string(); - std::free(string); - --g_numberOfMalloc[type_id]; - assert(g_numberOfMalloc[type_id] != -1); -} -void DeleteString(plg::string* string) { - delete string; - --g_numberOfAllocs[type_id]; - assert(g_numberOfAllocs[type_id] != -1); -} -enum DataType { +enum class DataType { Bool, Char8, Char16, @@ -1223,78 +1062,65 @@ enum DataType { String }; +#if defined(__clang__) +#define GOLM_FORCE_INLINE [[gnu::always_inline]] [[gnu::gnu_inline]] extern inline +#elif defined(__GNUC__) +#define GOLM_FORCE_INLINE [[gnu::always_inline]] inline +#elif defined(_MSC_VER) +#pragma warning(error: 4714) +#define GOLM_FORCE_INLINE __forceinline +#else +#define GOTLM_FORCE_INLINE inline +#endif + namespace { template - std::vector* CreateVector(T* arr, ptrdiff_t len) requires(!std::is_same_v) { - auto vector = len == 0 ? new std::vector() : new std::vector(arr, arr + len); - assert(vector); - ++g_numberOfAllocs[type_id>]; - return vector; + GOLM_FORCE_INLINE plugify::Vector ConstructVector(T* arr, ptrdiff_t len) requires(!std::is_same_v) { + plugify::Vector ret; + if (arr == nullptr || len == 0) [[unlikely]] + std::construct_at(reinterpret_cast*>(&ret)); + else + std::construct_at(reinterpret_cast*>(&ret), arr, arr + len); + return ret; } template - std::vector* CreateVector(T* arr, ptrdiff_t len) requires(std::is_same_v) { - auto vector = new std::vector(); - if (len != 0) { - vector->reserve(static_cast(len)); - for (ptrdiff_t i = 0; i < len; ++i) { - const auto& str = arr[i]; - vector->emplace_back(str.p, str.n); - } + GOLM_FORCE_INLINE plugify::Vector ConstructVector(T* arr, ptrdiff_t len) requires(std::is_same_v) { + plugify::Vector ret; + auto* vector = reinterpret_cast*>(&ret); + std::construct_at(vector); + size_t N = static_cast(len); + if (arr == nullptr || N == 0) [[unlikely]] + return ret; + vector->reserve(N); + for (size_t i = 0; i < N; ++i) { + const auto& str = arr[i]; + vector->emplace_back(str.p, static_cast(str.n)); } - assert(vector); - ++g_numberOfAllocs[type_id>]; - return vector; - } - - template - std::vector* AllocateVector() requires(!std::is_same_v) { - auto vector = static_cast*>(std::malloc(sizeof(std::vector))); - assert(vector); - ++g_numberOfMalloc[type_id>]; - return vector; - } - - template - std::vector* AllocateVector() requires(std::is_same_v) { - auto vector = static_cast*>(std::malloc(sizeof(std::vector))); - assert(vector); - ++g_numberOfMalloc[type_id>]; - return vector; - } - - - template - void DeleteVector(std::vector* vector) { - delete vector; - --g_numberOfAllocs[type_id>]; - assert(g_numberOfAllocs[type_id>] != -1); + return ret; } template - void FreeVector(std::vector* vector) { - vector->~vector(); - std::free(vector); - --g_numberOfMalloc[type_id>]; - assert(g_numberOfMalloc[type_id>] != -1); + GOLM_FORCE_INLINE void DestroyVector(plg::vector* vector) { + vector->~vector_base(); } template - ptrdiff_t GetVectorSize(std::vector* vector) { + GOLM_FORCE_INLINE ptrdiff_t GetVectorSize(plg::vector* vector) { return static_cast(vector->size()); } template - void AssignVector(std::vector* vector, T* arr, ptrdiff_t len) requires(!std::is_same_v) { - if (arr == nullptr || len == 0) + GOLM_FORCE_INLINE void AssignVector(plg::vector* vector, T* arr, ptrdiff_t len) requires(!std::is_same_v) { + if (arr == nullptr || len == 0) [[unlikely]] vector->clear(); else vector->assign(arr, arr + len); } template - void AssignVector(std::vector* vector, T* arr, ptrdiff_t len) requires(std::is_same_v) { - if (arr == nullptr || len == 0) + GOLM_FORCE_INLINE void AssignVector(plg::vector* vector, T* arr, ptrdiff_t len) requires(std::is_same_v) { + if (arr == nullptr || len == 0) [[unlikely]] vector->clear(); else { size_t N = static_cast(len); @@ -1307,426 +1133,246 @@ namespace { } template - T* GetVectorData(std::vector* vector) requires(!std::is_same_v and !std::is_same_v) { + GOLM_FORCE_INLINE T* GetVectorData(plg::vector* vector) requires(!std::is_same_v) { return vector->data(); } template - bool* GetVectorData(std::vector* vector) requires(std::is_same_v) { - bool* boolArray = new bool[vector->size()]; - - // Manually copy values from std::vector to the bool array - for (size_t i = 0; i < vector->size(); ++i) { - boolArray[i] = (*vector)[i]; - } - - ++g_numberOfAllocs[type_id]; - - return boolArray; - } - - template - char** GetVectorData(std::vector* vector) requires(std::is_same_v) { + GOLM_FORCE_INLINE char** GetVectorData(plg::vector* vector) requires(std::is_same_v) { char** strArray = new char*[vector->size()]; - // Manually copy values from std::vector to the char* array + // Manually copy values from plg::vector to the char* array for (size_t i = 0; i < vector->size(); ++i) { strArray[i] = (*vector)[i].data(); } - - ++g_numberOfAllocs[type_id]; return strArray; } - - template - void ConstructVector(std::vector* vector, T* arr, ptrdiff_t len) requires(!std::is_same_v) { - std::construct_at(vector, len == 0 ? std::vector() : std::vector(arr, arr + len)); - } - - template - void ConstructVector(std::vector* vector, T* arr, ptrdiff_t len) requires(std::is_same_v) { - std::construct_at(vector, std::vector()); - size_t N = static_cast(len); - vector->reserve(N); - for (size_t i = 0; i < N; ++i) { - const auto& str = arr[i]; - vector->emplace_back(str.p, static_cast(str.n)); - } - } -} - -void* CreateVector(void* arr, ptrdiff_t len, DataType type) { - switch (type) { - case Bool: - return CreateVector(static_cast(arr), len); - case Char8: - return CreateVector(static_cast(arr), len); - case Char16: - return CreateVector(static_cast(arr), len); - case Int8: - return CreateVector(static_cast(arr), len); - case Int16: - return CreateVector(static_cast(arr), len); - case Int32: - return CreateVector(static_cast(arr), len); - case Int64: - return CreateVector(static_cast(arr), len); - case UInt8: - return CreateVector(static_cast(arr), len); - case UInt16: - return CreateVector(static_cast(arr), len); - case UInt32: - return CreateVector(static_cast(arr), len); - case UInt64: - return CreateVector(static_cast(arr), len); - case Pointer: - return CreateVector(static_cast(arr), len); - case Float: - return CreateVector(static_cast(arr), len); - case Double: - return CreateVector(static_cast(arr), len); - case String: - return CreateVector(static_cast(arr), len); - default: - return nullptr; - } -} - -void* AllocateVector(DataType type) { - switch (type) { - case Bool: - return AllocateVector(); - case Char8: - return AllocateVector(); - case Char16: - return AllocateVector(); - case Int8: - return AllocateVector(); - case Int16: - return AllocateVector(); - case Int32: - return AllocateVector(); - case Int64: - return AllocateVector(); - case UInt8: - return AllocateVector(); - case UInt16: - return AllocateVector(); - case UInt32: - return AllocateVector(); - case UInt64: - return AllocateVector(); - case Pointer: - return AllocateVector(); - case Float: - return AllocateVector(); - case Double: - return AllocateVector(); - case String: - return AllocateVector(); - default: - return nullptr; - } } -ptrdiff_t GetVectorSize(void* ptr, DataType type) { - switch (type) { - case Char8: - return GetVectorSize(reinterpret_cast*>(ptr)); - case Char16: - return GetVectorSize(reinterpret_cast*>(ptr)); - case Int8: - return GetVectorSize(reinterpret_cast*>(ptr)); - case Int16: - return GetVectorSize(reinterpret_cast*>(ptr)); - case Int32: - return GetVectorSize(reinterpret_cast*>(ptr)); - case Int64: - return GetVectorSize(reinterpret_cast*>(ptr)); - case UInt8: - return GetVectorSize(reinterpret_cast*>(ptr)); - case UInt16: - return GetVectorSize(reinterpret_cast*>(ptr)); - case UInt32: - return GetVectorSize(reinterpret_cast*>(ptr)); - case UInt64: - return GetVectorSize(reinterpret_cast*>(ptr)); - case Pointer: - return GetVectorSize(reinterpret_cast*>(ptr)); - case Float: - return GetVectorSize(reinterpret_cast*>(ptr)); - case Double: - return GetVectorSize(reinterpret_cast*>(ptr)); - case Bool: - return GetVectorSize(reinterpret_cast*>(ptr)); - case String: - return GetVectorSize(reinterpret_cast*>(ptr)); - default: - return -1; // Return -1 or some error code for invalid type - } -} -void* GetVectorData(void* ptr, DataType type) { +plugify::Vector ConstructVector(void* arr, ptrdiff_t len, DataType type) { switch (type) { - case Bool: - return GetVectorData(reinterpret_cast*>(ptr)); - case Char8: - return GetVectorData<>(reinterpret_cast*>(ptr)); - case Char16: - return GetVectorData<>(reinterpret_cast*>(ptr)); - case Int8: - return GetVectorData<>(reinterpret_cast*>(ptr)); - case Int16: - return GetVectorData<>(reinterpret_cast*>(ptr)); - case Int32: - return GetVectorData<>(reinterpret_cast*>(ptr)); - case Int64: - return GetVectorData<>(reinterpret_cast*>(ptr)); - case UInt8: - return GetVectorData<>(reinterpret_cast*>(ptr)); - case UInt16: - return GetVectorData<>(reinterpret_cast*>(ptr)); - case UInt32: - return GetVectorData<>(reinterpret_cast*>(ptr)); - case UInt64: - return GetVectorData<>(reinterpret_cast*>(ptr)); - case Pointer: - return GetVectorData<>(reinterpret_cast*>(ptr)); - case Float: - return GetVectorData<>(reinterpret_cast*>(ptr)); - case Double: - return GetVectorData<>(reinterpret_cast*>(ptr)); - case String: - return GetVectorData(reinterpret_cast*>(ptr)); + case DataType::Bool: + return ConstructVector(static_cast(arr), len); + case DataType::Char8: + return ConstructVector(static_cast(arr), len); + case DataType::Char16: + return ConstructVector(static_cast(arr), len); + case DataType::Int8: + return ConstructVector(static_cast(arr), len); + case DataType::Int16: + return ConstructVector(static_cast(arr), len); + case DataType::Int32: + return ConstructVector(static_cast(arr), len); + case DataType::Int64: + return ConstructVector(static_cast(arr), len); + case DataType::UInt8: + return ConstructVector(static_cast(arr), len); + case DataType::UInt16: + return ConstructVector(static_cast(arr), len); + case DataType::UInt32: + return ConstructVector(static_cast(arr), len); + case DataType::UInt64: + return ConstructVector(static_cast(arr), len); + case DataType::Pointer: + return ConstructVector(static_cast(arr), len); + case DataType::Float: + return ConstructVector(static_cast(arr), len); + case DataType::Double: + return ConstructVector(static_cast(arr), len); + case DataType::String: + return ConstructVector(static_cast(arr), len); default: - return nullptr; // Return nullptr for invalid type + break; } + return {}; } -void ConstructVector(void* ptr, void* arr, ptrdiff_t len, DataType type) { +void DestroyVector(void* ptr, DataType type) { switch (type) { - case Bool: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::Bool: + DestroyVector(reinterpret_cast*>(ptr)); break; - case Char8: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::Char8: + DestroyVector(reinterpret_cast*>(ptr)); break; - case Char16: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::Char16: + DestroyVector(reinterpret_cast*>(ptr)); break; - case Int8: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::Int8: + DestroyVector(reinterpret_cast*>(ptr)); break; - case Int16: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::Int16: + DestroyVector(reinterpret_cast*>(ptr)); break; - case Int32: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::Int32: + DestroyVector(reinterpret_cast*>(ptr)); break; - case Int64: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::Int64: + DestroyVector(reinterpret_cast*>(ptr)); break; - case UInt8: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::UInt8: + DestroyVector(reinterpret_cast*>(ptr)); break; - case UInt16: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::UInt16: + DestroyVector(reinterpret_cast*>(ptr)); break; - case UInt32: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::UInt32: + DestroyVector(reinterpret_cast*>(ptr)); break; - case UInt64: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::UInt64: + DestroyVector(reinterpret_cast*>(ptr)); break; - case Pointer: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::Pointer: + DestroyVector(reinterpret_cast*>(ptr)); break; - case Float: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::Float: + DestroyVector(reinterpret_cast*>(ptr)); break; - case Double: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::Double: + DestroyVector(reinterpret_cast*>(ptr)); break; - case String: - ConstructVector(reinterpret_cast*>(ptr), static_cast(arr), len); + case DataType::String: + DestroyVector(reinterpret_cast*>(ptr)); break; default: + // Invalid type, do nothing or handle error if needed break; } } -void AssignVector(void* ptr, void* arr, ptrdiff_t len, DataType type) { +ptrdiff_t GetVectorSize(void* ptr, DataType type) { switch (type) { - case Bool: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; - case Char8: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; - case Char16: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; - case Int8: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; - case Int16: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; - case Int32: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; - case Int64: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; - case UInt8: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; - case UInt16: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; - case UInt32: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; - case UInt64: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; - case Pointer: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; - case Float: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; - case Double: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; - case String: - AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); - break; + case DataType::Char8: + return GetVectorSize(reinterpret_cast*>(ptr)); + case DataType::Char16: + return GetVectorSize(reinterpret_cast*>(ptr)); + case DataType::Int8: + return GetVectorSize(reinterpret_cast*>(ptr)); + case DataType::Int16: + return GetVectorSize(reinterpret_cast*>(ptr)); + case DataType::Int32: + return GetVectorSize(reinterpret_cast*>(ptr)); + case DataType::Int64: + return GetVectorSize(reinterpret_cast*>(ptr)); + case DataType::UInt8: + return GetVectorSize(reinterpret_cast*>(ptr)); + case DataType::UInt16: + return GetVectorSize(reinterpret_cast*>(ptr)); + case DataType::UInt32: + return GetVectorSize(reinterpret_cast*>(ptr)); + case DataType::UInt64: + return GetVectorSize(reinterpret_cast*>(ptr)); + case DataType::Pointer: + return GetVectorSize(reinterpret_cast*>(ptr)); + case DataType::Float: + return GetVectorSize(reinterpret_cast*>(ptr)); + case DataType::Double: + return GetVectorSize(reinterpret_cast*>(ptr)); + case DataType::Bool: + return GetVectorSize(reinterpret_cast*>(ptr)); + case DataType::String: + return GetVectorSize(reinterpret_cast*>(ptr)); default: - break; + return -1; // Return -1 or some error code for invalid type } } -void DeleteVector(void* ptr, DataType type) { +void* GetVectorData(void* ptr, DataType type) { switch (type) { - case Bool: - DeleteVector(reinterpret_cast*>(ptr)); - break; - case Char8: - DeleteVector(reinterpret_cast*>(ptr)); - break; - case Char16: - DeleteVector(reinterpret_cast*>(ptr)); - break; - case Int8: - DeleteVector(reinterpret_cast*>(ptr)); - break; - case Int16: - DeleteVector(reinterpret_cast*>(ptr)); - break; - case Int32: - DeleteVector(reinterpret_cast*>(ptr)); - break; - case Int64: - DeleteVector(reinterpret_cast*>(ptr)); - break; - case UInt8: - DeleteVector(reinterpret_cast*>(ptr)); - break; - case UInt16: - DeleteVector(reinterpret_cast*>(ptr)); - break; - case UInt32: - DeleteVector(reinterpret_cast*>(ptr)); - break; - case UInt64: - DeleteVector(reinterpret_cast*>(ptr)); - break; - case Pointer: - DeleteVector(reinterpret_cast*>(ptr)); - break; - case Float: - DeleteVector(reinterpret_cast*>(ptr)); - break; - case Double: - DeleteVector(reinterpret_cast*>(ptr)); - break; - case String: - DeleteVector(reinterpret_cast*>(ptr)); - break; + case DataType::Bool: + return GetVectorData<>(reinterpret_cast*>(ptr)); + case DataType::Char8: + return GetVectorData<>(reinterpret_cast*>(ptr)); + case DataType::Char16: + return GetVectorData<>(reinterpret_cast*>(ptr)); + case DataType::Int8: + return GetVectorData<>(reinterpret_cast*>(ptr)); + case DataType::Int16: + return GetVectorData<>(reinterpret_cast*>(ptr)); + case DataType::Int32: + return GetVectorData<>(reinterpret_cast*>(ptr)); + case DataType::Int64: + return GetVectorData<>(reinterpret_cast*>(ptr)); + case DataType::UInt8: + return GetVectorData<>(reinterpret_cast*>(ptr)); + case DataType::UInt16: + return GetVectorData<>(reinterpret_cast*>(ptr)); + case DataType::UInt32: + return GetVectorData<>(reinterpret_cast*>(ptr)); + case DataType::UInt64: + return GetVectorData<>(reinterpret_cast*>(ptr)); + case DataType::Pointer: + return GetVectorData<>(reinterpret_cast*>(ptr)); + case DataType::Float: + return GetVectorData<>(reinterpret_cast*>(ptr)); + case DataType::Double: + return GetVectorData<>(reinterpret_cast*>(ptr)); + case DataType::String: + return GetVectorData(reinterpret_cast*>(ptr)); default: - // Invalid type, do nothing or handle error if needed - break; + return nullptr; // Return nullptr for invalid type } } -void FreeVector(void* ptr, DataType type) { +void AssignVector(void* ptr, void* arr, ptrdiff_t len, DataType type) { switch (type) { - case Bool: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::Bool: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; - case Char8: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::Char8: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; - case Char16: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::Char16: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; - case Int8: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::Int8: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; - case Int16: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::Int16: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; - case Int32: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::Int32: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; - case Int64: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::Int64: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; - case UInt8: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::UInt8: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; - case UInt16: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::UInt16: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; - case UInt32: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::UInt32: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; - case UInt64: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::UInt64: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; - case Pointer: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::Pointer: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; - case Float: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::Float: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; - case Double: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::Double: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; - case String: - FreeVector(reinterpret_cast*>(ptr)); + case DataType::String: + AssignVector(reinterpret_cast*>(ptr), static_cast(arr), len); break; default: - // Invalid type, do nothing or handle error if needed - return; + break; } } -void DeleteVectorDataBool(void* ptr) { - delete[] reinterpret_cast(ptr); - --g_numberOfAllocs[type_id]; - assert(g_numberOfAllocs[type_id] != -1); -} - void DeleteVectorDataCStr(void* ptr) { delete[] reinterpret_cast(ptr); - --g_numberOfAllocs[type_id]; - assert(g_numberOfAllocs[type_id] != -1); } -const std::array GoLanguageModule::_pluginApi = { +const std::array GoLanguageModule::_pluginApi = { reinterpret_cast(&::GetMethodPtr), reinterpret_cast(&::GetMethodPtr2), reinterpret_cast(&::GetBaseDir), @@ -1744,23 +1390,16 @@ const std::array GoLanguageModule::_pluginApi = { reinterpret_cast(&::GetPluginDependenciesSize), reinterpret_cast(&::FindPluginResource), reinterpret_cast(&::DeleteCStr), - reinterpret_cast(&::AllocateString), - reinterpret_cast(&::CreateString), + reinterpret_cast(&::ConstructString), + reinterpret_cast(&::DestroyString), reinterpret_cast(&::GetStringData), reinterpret_cast(&::GetStringLength), - reinterpret_cast(&::ConstructString), reinterpret_cast(&::AssignString), - reinterpret_cast(&::FreeString), - reinterpret_cast(&::DeleteString), - reinterpret_cast(&::CreateVector), - reinterpret_cast(&::AllocateVector), - reinterpret_cast(&::GetVectorSize), - reinterpret_cast(&::GetVectorData), reinterpret_cast(&::ConstructVector), + reinterpret_cast(&::DestroyVector), + reinterpret_cast(&::GetVectorData), + reinterpret_cast(&::GetVectorSize), reinterpret_cast(&::AssignVector), - reinterpret_cast(&::DeleteVector), - reinterpret_cast(&::FreeVector), - reinterpret_cast(&::DeleteVectorDataBool), reinterpret_cast(&::DeleteVectorDataCStr) }; diff --git a/src/module.h b/src/module.hpp similarity index 94% rename from src/module.h rename to src/module.hpp index 1698218..0060b35 100644 --- a/src/module.h +++ b/src/module.hpp @@ -2,10 +2,10 @@ #include #include -#include -#include -#include -#include +#include +#include +#include +#include typedef signed char GoInt8; typedef unsigned char GoUint8; @@ -107,7 +107,6 @@ namespace golm { private: static void InternalCall(plugify::MethodRef method, plugify::MemAddr data, const plugify::JitCallback::Parameters* params, uint8_t count, const plugify::JitCallback::Return* ret); - static void DetectLeaks(); private: std::shared_ptr _rt; @@ -119,7 +118,7 @@ namespace golm { std::vector _functions; std::vector _addresses; - static const std::array _pluginApi; + static const std::array _pluginApi; }; extern GoLanguageModule g_golm; diff --git a/src/pch.h b/src/pch.hpp similarity index 90% rename from src/pch.h rename to src/pch.hpp index e226cda..7125a1f 100644 --- a/src/pch.h +++ b/src/pch.hpp @@ -18,4 +18,4 @@ #include namespace fs = std::filesystem; -#include +#include diff --git a/test/cross_call_worker/cross_call_master/cross_call_master.go b/test/cross_call_worker/cross_call_master/cross_call_master.go index 4bea38c..5eb9320 100644 --- a/test/cross_call_worker/cross_call_master/cross_call_master.go +++ b/test/cross_call_worker/cross_call_master/cross_call_master.go @@ -26,11 +26,11 @@ type Matrix4x4 struct { } func ReverseReturn(returnString string) { - C_returnString := C.Plugify_CreateString(returnString) + C_returnString := C.Plugify_ConstructString(returnString) - C.ReverseReturn(C_returnString) + C.ReverseReturn(&C_returnString) - C.Plugify_DeleteString(C_returnString) + C.Plugify_DestroyString(&C_returnString) } @@ -109,244 +109,227 @@ func NoParamReturnDoubleCallback() float64 { } func NoParamReturnFunctionCallback() uintptr { - result := C.NoParamReturnFunctionCallback() - return uintptr(result) + result := uintptr(C.NoParamReturnFunctionCallback()) + return result } func NoParamReturnStringCallback() string { - C_output := C.Plugify_AllocateString() - C.NoParamReturnStringCallback(C_output) + C_output := C.NoParamReturnStringCallback() - P_output := C.Plugify_GetStringData(C_output) + P_output := C.Plugify_GetStringData(&C_output) output := C.GoString(P_output) - C.Plugify_FreeString(C_output) + C.Plugify_DestroyString(&C_output) return output } func NoParamReturnArrayBoolCallback() []bool { - C_output := C.Plugify_AllocateVector(C.BOOL) - C.NoParamReturnArrayBoolCallback(C_output) + C_output := C.NoParamReturnArrayBoolCallback() - L_output := C.Plugify_GetVectorSize(C_output, C.BOOL) - P_output := C.Plugify_GetVectorData(C_output, C.BOOL) + L_output := C.Plugify_GetVectorSize(&C_output, C.BOOL) + P_output := C.Plugify_GetVectorData(&C_output, C.BOOL) output := make([]bool, L_output) for i := range output { output[i] = *(*bool)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_bool))) } - C.Plugify_DeleteVectorDataBool(P_output) - C.Plugify_FreeVector(C_output, C.BOOL) + C.Plugify_DestroyVector(&C_output, C.BOOL) return output } func NoParamReturnArrayChar8Callback() []int8 { - C_output := C.Plugify_AllocateVector(C.CHAR8) - C.NoParamReturnArrayChar8Callback(C_output) + C_output := C.NoParamReturnArrayChar8Callback() - L_output := C.Plugify_GetVectorSize(C_output, C.CHAR8) - P_output := C.Plugify_GetVectorData(C_output, C.CHAR8) + L_output := C.Plugify_GetVectorSize(&C_output, C.CHAR8) + P_output := C.Plugify_GetVectorData(&C_output, C.CHAR8) output := make([]int8, L_output) for i := range output { output[i] = *(*int8)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_char))) } - C.Plugify_FreeVector(C_output, C.CHAR8) + C.Plugify_DestroyVector(&C_output, C.CHAR8) return output } func NoParamReturnArrayChar16Callback() []uint16 { - C_output := C.Plugify_AllocateVector(C.CHAR16) - C.NoParamReturnArrayChar16Callback(C_output) + C_output := C.NoParamReturnArrayChar16Callback() - L_output := C.Plugify_GetVectorSize(C_output, C.CHAR16) - P_output := C.Plugify_GetVectorData(C_output, C.CHAR16) + L_output := C.Plugify_GetVectorSize(&C_output, C.CHAR16) + P_output := C.Plugify_GetVectorData(&C_output, C.CHAR16) output := make([]uint16, L_output) for i := range output { output[i] = *(*uint16)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_uint16_t))) } - C.Plugify_FreeVector(C_output, C.CHAR16) + C.Plugify_DestroyVector(&C_output, C.CHAR16) return output } func NoParamReturnArrayInt8Callback() []int8 { - C_output := C.Plugify_AllocateVector(C.INT8) - C.NoParamReturnArrayInt8Callback(C_output) + C_output := C.NoParamReturnArrayInt8Callback() - L_output := C.Plugify_GetVectorSize(C_output, C.INT8) - P_output := C.Plugify_GetVectorData(C_output, C.INT8) + L_output := C.Plugify_GetVectorSize(&C_output, C.INT8) + P_output := C.Plugify_GetVectorData(&C_output, C.INT8) output := make([]int8, L_output) for i := range output { output[i] = *(*int8)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_int8_t))) } - C.Plugify_FreeVector(C_output, C.INT8) + C.Plugify_DestroyVector(&C_output, C.INT8) return output } func NoParamReturnArrayInt16Callback() []int16 { - C_output := C.Plugify_AllocateVector(C.INT16) - C.NoParamReturnArrayInt16Callback(C_output) + C_output := C.NoParamReturnArrayInt16Callback() - L_output := C.Plugify_GetVectorSize(C_output, C.INT16) - P_output := C.Plugify_GetVectorData(C_output, C.INT16) + L_output := C.Plugify_GetVectorSize(&C_output, C.INT16) + P_output := C.Plugify_GetVectorData(&C_output, C.INT16) output := make([]int16, L_output) for i := range output { output[i] = *(*int16)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_int16_t))) } - C.Plugify_FreeVector(C_output, C.INT16) + C.Plugify_DestroyVector(&C_output, C.INT16) return output } func NoParamReturnArrayInt32Callback() []int32 { - C_output := C.Plugify_AllocateVector(C.INT32) - C.NoParamReturnArrayInt32Callback(C_output) + C_output := C.NoParamReturnArrayInt32Callback() - L_output := C.Plugify_GetVectorSize(C_output, C.INT32) - P_output := C.Plugify_GetVectorData(C_output, C.INT32) + L_output := C.Plugify_GetVectorSize(&C_output, C.INT32) + P_output := C.Plugify_GetVectorData(&C_output, C.INT32) output := make([]int32, L_output) for i := range output { output[i] = *(*int32)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_int32_t))) } - C.Plugify_FreeVector(C_output, C.INT32) + C.Plugify_DestroyVector(&C_output, C.INT32) return output } func NoParamReturnArrayInt64Callback() []int64 { - C_output := C.Plugify_AllocateVector(C.INT64) - C.NoParamReturnArrayInt64Callback(C_output) + C_output := C.NoParamReturnArrayInt64Callback() - L_output := C.Plugify_GetVectorSize(C_output, C.INT64) - P_output := C.Plugify_GetVectorData(C_output, C.INT64) + L_output := C.Plugify_GetVectorSize(&C_output, C.INT64) + P_output := C.Plugify_GetVectorData(&C_output, C.INT64) output := make([]int64, L_output) for i := range output { output[i] = *(*int64)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_int64_t))) } - C.Plugify_FreeVector(C_output, C.INT64) + C.Plugify_DestroyVector(&C_output, C.INT64) return output } func NoParamReturnArrayUInt8Callback() []uint8 { - C_output := C.Plugify_AllocateVector(C.UINT8) - C.NoParamReturnArrayUInt8Callback(C_output) + C_output := C.NoParamReturnArrayUInt8Callback() - L_output := C.Plugify_GetVectorSize(C_output, C.UINT8) - P_output := C.Plugify_GetVectorData(C_output, C.UINT8) + L_output := C.Plugify_GetVectorSize(&C_output, C.UINT8) + P_output := C.Plugify_GetVectorData(&C_output, C.UINT8) output := make([]uint8, L_output) for i := range output { output[i] = *(*uint8)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_uint8_t))) } - C.Plugify_FreeVector(C_output, C.UINT8) + C.Plugify_DestroyVector(&C_output, C.UINT8) return output } func NoParamReturnArrayUInt16Callback() []uint16 { - C_output := C.Plugify_AllocateVector(C.UINT16) - C.NoParamReturnArrayUInt16Callback(C_output) + C_output := C.NoParamReturnArrayUInt16Callback() - L_output := C.Plugify_GetVectorSize(C_output, C.UINT16) - P_output := C.Plugify_GetVectorData(C_output, C.UINT16) + L_output := C.Plugify_GetVectorSize(&C_output, C.UINT16) + P_output := C.Plugify_GetVectorData(&C_output, C.UINT16) output := make([]uint16, L_output) for i := range output { output[i] = *(*uint16)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_uint16_t))) } - C.Plugify_FreeVector(C_output, C.UINT16) + C.Plugify_DestroyVector(&C_output, C.UINT16) return output } func NoParamReturnArrayUInt32Callback() []uint32 { - C_output := C.Plugify_AllocateVector(C.UINT32) - C.NoParamReturnArrayUInt32Callback(C_output) + C_output := C.NoParamReturnArrayUInt32Callback() - L_output := C.Plugify_GetVectorSize(C_output, C.UINT32) - P_output := C.Plugify_GetVectorData(C_output, C.UINT32) + L_output := C.Plugify_GetVectorSize(&C_output, C.UINT32) + P_output := C.Plugify_GetVectorData(&C_output, C.UINT32) output := make([]uint32, L_output) for i := range output { output[i] = *(*uint32)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_uint32_t))) } - C.Plugify_FreeVector(C_output, C.UINT32) + C.Plugify_DestroyVector(&C_output, C.UINT32) return output } func NoParamReturnArrayUInt64Callback() []uint64 { - C_output := C.Plugify_AllocateVector(C.UINT64) - C.NoParamReturnArrayUInt64Callback(C_output) + C_output := C.NoParamReturnArrayUInt64Callback() - L_output := C.Plugify_GetVectorSize(C_output, C.UINT64) - P_output := C.Plugify_GetVectorData(C_output, C.UINT64) + L_output := C.Plugify_GetVectorSize(&C_output, C.UINT64) + P_output := C.Plugify_GetVectorData(&C_output, C.UINT64) output := make([]uint64, L_output) for i := range output { output[i] = *(*uint64)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_uint64_t))) } - C.Plugify_FreeVector(C_output, C.UINT64) + C.Plugify_DestroyVector(&C_output, C.UINT64) return output } func NoParamReturnArrayPointerCallback() []uintptr { - C_output := C.Plugify_AllocateVector(C.POINTER) - C.NoParamReturnArrayPointerCallback(C_output) + C_output := C.NoParamReturnArrayPointerCallback() - L_output := C.Plugify_GetVectorSize(C_output, C.POINTER) - P_output := C.Plugify_GetVectorData(C_output, C.POINTER) + L_output := C.Plugify_GetVectorSize(&C_output, C.POINTER) + P_output := C.Plugify_GetVectorData(&C_output, C.POINTER) output := make([]uintptr, L_output) for i := range output { output[i] = *(*uintptr)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_uintptr_t))) } - C.Plugify_FreeVector(C_output, C.POINTER) + C.Plugify_DestroyVector(&C_output, C.POINTER) return output } func NoParamReturnArrayFloatCallback() []float32 { - C_output := C.Plugify_AllocateVector(C.FLOAT) - C.NoParamReturnArrayFloatCallback(C_output) + C_output := C.NoParamReturnArrayFloatCallback() - L_output := C.Plugify_GetVectorSize(C_output, C.FLOAT) - P_output := C.Plugify_GetVectorData(C_output, C.FLOAT) + L_output := C.Plugify_GetVectorSize(&C_output, C.FLOAT) + P_output := C.Plugify_GetVectorData(&C_output, C.FLOAT) output := make([]float32, L_output) for i := range output { output[i] = *(*float32)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_float))) } - C.Plugify_FreeVector(C_output, C.FLOAT) + C.Plugify_DestroyVector(&C_output, C.FLOAT) return output } func NoParamReturnArrayDoubleCallback() []float64 { - C_output := C.Plugify_AllocateVector(C.DOUBLE) - C.NoParamReturnArrayDoubleCallback(C_output) + C_output := C.NoParamReturnArrayDoubleCallback() - L_output := C.Plugify_GetVectorSize(C_output, C.DOUBLE) - P_output := C.Plugify_GetVectorData(C_output, C.DOUBLE) + L_output := C.Plugify_GetVectorSize(&C_output, C.DOUBLE) + P_output := C.Plugify_GetVectorData(&C_output, C.DOUBLE) output := make([]float64, L_output) for i := range output { output[i] = *(*float64)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_double))) } - C.Plugify_FreeVector(C_output, C.DOUBLE) + C.Plugify_DestroyVector(&C_output, C.DOUBLE) return output } func NoParamReturnArrayStringCallback() []string { - C_output := C.Plugify_AllocateVector(C.STRING) - C.NoParamReturnArrayStringCallback(C_output) + C_output := C.NoParamReturnArrayStringCallback() - L_output := C.Plugify_GetVectorSize(C_output, C.STRING) - P_output := C.Plugify_GetVectorData(C_output, C.STRING) + L_output := C.Plugify_GetVectorSize(&C_output, C.STRING) + P_output := C.Plugify_GetVectorData(&C_output, C.STRING) output := make([]string, L_output) for i := range output { output[i] = C.GoString(*(**C.char)(unsafe.Pointer(uintptr(P_output) + uintptr(i*C.sizeof_uintptr_t)))) } C.Plugify_DeleteVectorDataCStr(P_output) - C.Plugify_FreeVector(C_output, C.STRING) + C.Plugify_DestroyVector(&C_output, C.STRING) return output } @@ -412,11 +395,11 @@ func Param5Callback(a int32, b float32, c float64, d Vector4, e []int64) { } else { A_e = nil } - C_e := C.Plugify_CreateVector(A_e, C.ptrdiff_t(S_e), C.INT64) + C_e := C.Plugify_ConstructVector(A_e, C.ptrdiff_t(S_e), C.INT64) - C.Param5Callback(C_a, C_b, C_c, &C_d, C_e) + C.Param5Callback(C_a, C_b, C_c, &C_d, &C_e) - C.Plugify_DeleteVector(C_e, C.INT64) + C.Plugify_DestroyVector(&C_e, C.INT64) } @@ -432,12 +415,12 @@ func Param6Callback(a int32, b float32, c float64, d Vector4, e []int64, f int8) } else { A_e = nil } - C_e := C.Plugify_CreateVector(A_e, C.ptrdiff_t(S_e), C.INT64) + C_e := C.Plugify_ConstructVector(A_e, C.ptrdiff_t(S_e), C.INT64) C_f := C.char(f) - C.Param6Callback(C_a, C_b, C_c, &C_d, C_e, C_f) + C.Param6Callback(C_a, C_b, C_c, &C_d, &C_e, C_f) - C.Plugify_DeleteVector(C_e, C.INT64) + C.Plugify_DestroyVector(&C_e, C.INT64) } @@ -453,14 +436,14 @@ func Param7Callback(a int32, b float32, c float64, d Vector4, e []int64, f int8, } else { A_e = nil } - C_e := C.Plugify_CreateVector(A_e, C.ptrdiff_t(S_e), C.INT64) + C_e := C.Plugify_ConstructVector(A_e, C.ptrdiff_t(S_e), C.INT64) C_f := C.char(f) - C_g := C.Plugify_CreateString(g) + C_g := C.Plugify_ConstructString(g) - C.Param7Callback(C_a, C_b, C_c, &C_d, C_e, C_f, C_g) + C.Param7Callback(C_a, C_b, C_c, &C_d, &C_e, C_f, &C_g) - C.Plugify_DeleteVector(C_e, C.INT64) - C.Plugify_DeleteString(C_g) + C.Plugify_DestroyVector(&C_e, C.INT64) + C.Plugify_DestroyString(&C_g) } @@ -476,15 +459,15 @@ func Param8Callback(a int32, b float32, c float64, d Vector4, e []int64, f int8, } else { A_e = nil } - C_e := C.Plugify_CreateVector(A_e, C.ptrdiff_t(S_e), C.INT64) + C_e := C.Plugify_ConstructVector(A_e, C.ptrdiff_t(S_e), C.INT64) C_f := C.char(f) - C_g := C.Plugify_CreateString(g) + C_g := C.Plugify_ConstructString(g) C_h := C.uint16_t(h) - C.Param8Callback(C_a, C_b, C_c, &C_d, C_e, C_f, C_g, C_h) + C.Param8Callback(C_a, C_b, C_c, &C_d, &C_e, C_f, &C_g, C_h) - C.Plugify_DeleteVector(C_e, C.INT64) - C.Plugify_DeleteString(C_g) + C.Plugify_DestroyVector(&C_e, C.INT64) + C.Plugify_DestroyString(&C_g) } @@ -500,16 +483,16 @@ func Param9Callback(a int32, b float32, c float64, d Vector4, e []int64, f int8, } else { A_e = nil } - C_e := C.Plugify_CreateVector(A_e, C.ptrdiff_t(S_e), C.INT64) + C_e := C.Plugify_ConstructVector(A_e, C.ptrdiff_t(S_e), C.INT64) C_f := C.char(f) - C_g := C.Plugify_CreateString(g) + C_g := C.Plugify_ConstructString(g) C_h := C.uint16_t(h) C_k := C.int16_t(k) - C.Param9Callback(C_a, C_b, C_c, &C_d, C_e, C_f, C_g, C_h, C_k) + C.Param9Callback(C_a, C_b, C_c, &C_d, &C_e, C_f, &C_g, C_h, C_k) - C.Plugify_DeleteVector(C_e, C.INT64) - C.Plugify_DeleteString(C_g) + C.Plugify_DestroyVector(&C_e, C.INT64) + C.Plugify_DestroyString(&C_g) } @@ -525,17 +508,17 @@ func Param10Callback(a int32, b float32, c float64, d Vector4, e []int64, f int8 } else { A_e = nil } - C_e := C.Plugify_CreateVector(A_e, C.ptrdiff_t(S_e), C.INT64) + C_e := C.Plugify_ConstructVector(A_e, C.ptrdiff_t(S_e), C.INT64) C_f := C.char(f) - C_g := C.Plugify_CreateString(g) + C_g := C.Plugify_ConstructString(g) C_h := C.uint16_t(h) C_k := C.int16_t(k) C_l := C.uintptr_t(l) - C.Param10Callback(C_a, C_b, C_c, &C_d, C_e, C_f, C_g, C_h, C_k, C_l) + C.Param10Callback(C_a, C_b, C_c, &C_d, &C_e, C_f, &C_g, C_h, C_k, C_l) - C.Plugify_DeleteVector(C_e, C.INT64) - C.Plugify_DeleteString(C_g) + C.Plugify_DestroyVector(&C_e, C.INT64) + C.Plugify_DestroyString(&C_g) } @@ -583,19 +566,19 @@ func ParamRef5Callback(a *int32, b *float32, c *float64, d *Vector4, e *[]int64) } else { A_e = nil } - C_e := C.Plugify_CreateVector(A_e, C.ptrdiff_t(S_e), C.INT64) + C_e := C.Plugify_ConstructVector(A_e, C.ptrdiff_t(S_e), C.INT64) - C.ParamRef5Callback(C_a, C_b, C_c, &C_d, C_e) + C.ParamRef5Callback(C_a, C_b, C_c, &C_d, &C_e) *d = *(*Vector4)(unsafe.Pointer(&C_d)) - L_e := C.Plugify_GetVectorSize(C_e, C.INT64) - P_e := C.Plugify_GetVectorData(C_e, C.INT64) + L_e := C.Plugify_GetVectorSize(&C_e, C.INT64) + P_e := C.Plugify_GetVectorData(&C_e, C.INT64) *e = make([]int64, L_e) for i := range *e { (*e)[i] = *(*int64)(unsafe.Pointer(uintptr(P_e) + uintptr(i*C.sizeof_int64_t))) } - C.Plugify_DeleteVector(C_e, C.INT64) + C.Plugify_DestroyVector(&C_e, C.INT64) } @@ -611,20 +594,20 @@ func ParamRef6Callback(a *int32, b *float32, c *float64, d *Vector4, e *[]int64, } else { A_e = nil } - C_e := C.Plugify_CreateVector(A_e, C.ptrdiff_t(S_e), C.INT64) + C_e := C.Plugify_ConstructVector(A_e, C.ptrdiff_t(S_e), C.INT64) C_f := (*C.char)(f) - C.ParamRef6Callback(C_a, C_b, C_c, &C_d, C_e, C_f) + C.ParamRef6Callback(C_a, C_b, C_c, &C_d, &C_e, C_f) *d = *(*Vector4)(unsafe.Pointer(&C_d)) - L_e := C.Plugify_GetVectorSize(C_e, C.INT64) - P_e := C.Plugify_GetVectorData(C_e, C.INT64) + L_e := C.Plugify_GetVectorSize(&C_e, C.INT64) + P_e := C.Plugify_GetVectorData(&C_e, C.INT64) *e = make([]int64, L_e) for i := range *e { (*e)[i] = *(*int64)(unsafe.Pointer(uintptr(P_e) + uintptr(i*C.sizeof_int64_t))) } - C.Plugify_DeleteVector(C_e, C.INT64) + C.Plugify_DestroyVector(&C_e, C.INT64) } @@ -640,24 +623,24 @@ func ParamRef7Callback(a *int32, b *float32, c *float64, d *Vector4, e *[]int64, } else { A_e = nil } - C_e := C.Plugify_CreateVector(A_e, C.ptrdiff_t(S_e), C.INT64) + C_e := C.Plugify_ConstructVector(A_e, C.ptrdiff_t(S_e), C.INT64) C_f := (*C.char)(f) - C_g := C.Plugify_CreateString(*g) + C_g := C.Plugify_ConstructString(*g) - C.ParamRef7Callback(C_a, C_b, C_c, &C_d, C_e, C_f, C_g) + C.ParamRef7Callback(C_a, C_b, C_c, &C_d, &C_e, C_f, &C_g) *d = *(*Vector4)(unsafe.Pointer(&C_d)) - L_e := C.Plugify_GetVectorSize(C_e, C.INT64) - P_e := C.Plugify_GetVectorData(C_e, C.INT64) + L_e := C.Plugify_GetVectorSize(&C_e, C.INT64) + P_e := C.Plugify_GetVectorData(&C_e, C.INT64) *e = make([]int64, L_e) for i := range *e { (*e)[i] = *(*int64)(unsafe.Pointer(uintptr(P_e) + uintptr(i*C.sizeof_int64_t))) } - P_g := C.Plugify_GetStringData(C_g) + P_g := C.Plugify_GetStringData(&C_g) *g = C.GoString(P_g) - C.Plugify_DeleteVector(C_e, C.INT64) - C.Plugify_DeleteString(C_g) + C.Plugify_DestroyVector(&C_e, C.INT64) + C.Plugify_DestroyString(&C_g) } @@ -673,25 +656,25 @@ func ParamRef8Callback(a *int32, b *float32, c *float64, d *Vector4, e *[]int64, } else { A_e = nil } - C_e := C.Plugify_CreateVector(A_e, C.ptrdiff_t(S_e), C.INT64) + C_e := C.Plugify_ConstructVector(A_e, C.ptrdiff_t(S_e), C.INT64) C_f := (*C.char)(f) - C_g := C.Plugify_CreateString(*g) + C_g := C.Plugify_ConstructString(*g) C_h := (*C.uint16_t)(h) - C.ParamRef8Callback(C_a, C_b, C_c, &C_d, C_e, C_f, C_g, C_h) + C.ParamRef8Callback(C_a, C_b, C_c, &C_d, &C_e, C_f, &C_g, C_h) *d = *(*Vector4)(unsafe.Pointer(&C_d)) - L_e := C.Plugify_GetVectorSize(C_e, C.INT64) - P_e := C.Plugify_GetVectorData(C_e, C.INT64) + L_e := C.Plugify_GetVectorSize(&C_e, C.INT64) + P_e := C.Plugify_GetVectorData(&C_e, C.INT64) *e = make([]int64, L_e) for i := range *e { (*e)[i] = *(*int64)(unsafe.Pointer(uintptr(P_e) + uintptr(i*C.sizeof_int64_t))) } - P_g := C.Plugify_GetStringData(C_g) + P_g := C.Plugify_GetStringData(&C_g) *g = C.GoString(P_g) - C.Plugify_DeleteVector(C_e, C.INT64) - C.Plugify_DeleteString(C_g) + C.Plugify_DestroyVector(&C_e, C.INT64) + C.Plugify_DestroyString(&C_g) } @@ -707,26 +690,26 @@ func ParamRef9Callback(a *int32, b *float32, c *float64, d *Vector4, e *[]int64, } else { A_e = nil } - C_e := C.Plugify_CreateVector(A_e, C.ptrdiff_t(S_e), C.INT64) + C_e := C.Plugify_ConstructVector(A_e, C.ptrdiff_t(S_e), C.INT64) C_f := (*C.char)(f) - C_g := C.Plugify_CreateString(*g) + C_g := C.Plugify_ConstructString(*g) C_h := (*C.uint16_t)(h) C_k := (*C.int16_t)(k) - C.ParamRef9Callback(C_a, C_b, C_c, &C_d, C_e, C_f, C_g, C_h, C_k) + C.ParamRef9Callback(C_a, C_b, C_c, &C_d, &C_e, C_f, &C_g, C_h, C_k) *d = *(*Vector4)(unsafe.Pointer(&C_d)) - L_e := C.Plugify_GetVectorSize(C_e, C.INT64) - P_e := C.Plugify_GetVectorData(C_e, C.INT64) + L_e := C.Plugify_GetVectorSize(&C_e, C.INT64) + P_e := C.Plugify_GetVectorData(&C_e, C.INT64) *e = make([]int64, L_e) for i := range *e { (*e)[i] = *(*int64)(unsafe.Pointer(uintptr(P_e) + uintptr(i*C.sizeof_int64_t))) } - P_g := C.Plugify_GetStringData(C_g) + P_g := C.Plugify_GetStringData(&C_g) *g = C.GoString(P_g) - C.Plugify_DeleteVector(C_e, C.INT64) - C.Plugify_DeleteString(C_g) + C.Plugify_DestroyVector(&C_e, C.INT64) + C.Plugify_DestroyString(&C_g) } @@ -742,27 +725,27 @@ func ParamRef10Callback(a *int32, b *float32, c *float64, d *Vector4, e *[]int64 } else { A_e = nil } - C_e := C.Plugify_CreateVector(A_e, C.ptrdiff_t(S_e), C.INT64) + C_e := C.Plugify_ConstructVector(A_e, C.ptrdiff_t(S_e), C.INT64) C_f := (*C.char)(f) - C_g := C.Plugify_CreateString(*g) + C_g := C.Plugify_ConstructString(*g) C_h := (*C.uint16_t)(h) C_k := (*C.int16_t)(k) C_l := (*C.uintptr_t)(unsafe.Pointer(l)) - C.ParamRef10Callback(C_a, C_b, C_c, &C_d, C_e, C_f, C_g, C_h, C_k, C_l) + C.ParamRef10Callback(C_a, C_b, C_c, &C_d, &C_e, C_f, &C_g, C_h, C_k, C_l) *d = *(*Vector4)(unsafe.Pointer(&C_d)) - L_e := C.Plugify_GetVectorSize(C_e, C.INT64) - P_e := C.Plugify_GetVectorData(C_e, C.INT64) + L_e := C.Plugify_GetVectorSize(&C_e, C.INT64) + P_e := C.Plugify_GetVectorData(&C_e, C.INT64) *e = make([]int64, L_e) for i := range *e { (*e)[i] = *(*int64)(unsafe.Pointer(uintptr(P_e) + uintptr(i*C.sizeof_int64_t))) } - P_g := C.Plugify_GetStringData(C_g) + P_g := C.Plugify_GetStringData(&C_g) *g = C.GoString(P_g) - C.Plugify_DeleteVector(C_e, C.INT64) - C.Plugify_DeleteString(C_g) + C.Plugify_DestroyVector(&C_e, C.INT64) + C.Plugify_DestroyString(&C_g) } @@ -774,7 +757,7 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p1 = nil } - C_p1 := C.Plugify_CreateVector(A_p1, C.ptrdiff_t(S_p1), C.BOOL) + C_p1 := C.Plugify_ConstructVector(A_p1, C.ptrdiff_t(S_p1), C.BOOL) var A_p2 unsafe.Pointer S_p2 := len(*p2) if S_p2 > 0 { @@ -782,7 +765,7 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p2 = nil } - C_p2 := C.Plugify_CreateVector(A_p2, C.ptrdiff_t(S_p2), C.CHAR8) + C_p2 := C.Plugify_ConstructVector(A_p2, C.ptrdiff_t(S_p2), C.CHAR8) var A_p3 unsafe.Pointer S_p3 := len(*p3) if S_p3 > 0 { @@ -790,7 +773,7 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p3 = nil } - C_p3 := C.Plugify_CreateVector(A_p3, C.ptrdiff_t(S_p3), C.CHAR16) + C_p3 := C.Plugify_ConstructVector(A_p3, C.ptrdiff_t(S_p3), C.CHAR16) var A_p4 unsafe.Pointer S_p4 := len(*p4) if S_p4 > 0 { @@ -798,7 +781,7 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p4 = nil } - C_p4 := C.Plugify_CreateVector(A_p4, C.ptrdiff_t(S_p4), C.INT8) + C_p4 := C.Plugify_ConstructVector(A_p4, C.ptrdiff_t(S_p4), C.INT8) var A_p5 unsafe.Pointer S_p5 := len(*p5) if S_p5 > 0 { @@ -806,7 +789,7 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p5 = nil } - C_p5 := C.Plugify_CreateVector(A_p5, C.ptrdiff_t(S_p5), C.INT16) + C_p5 := C.Plugify_ConstructVector(A_p5, C.ptrdiff_t(S_p5), C.INT16) var A_p6 unsafe.Pointer S_p6 := len(*p6) if S_p6 > 0 { @@ -814,7 +797,7 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p6 = nil } - C_p6 := C.Plugify_CreateVector(A_p6, C.ptrdiff_t(S_p6), C.INT32) + C_p6 := C.Plugify_ConstructVector(A_p6, C.ptrdiff_t(S_p6), C.INT32) var A_p7 unsafe.Pointer S_p7 := len(*p7) if S_p7 > 0 { @@ -822,7 +805,7 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p7 = nil } - C_p7 := C.Plugify_CreateVector(A_p7, C.ptrdiff_t(S_p7), C.INT64) + C_p7 := C.Plugify_ConstructVector(A_p7, C.ptrdiff_t(S_p7), C.INT64) var A_p8 unsafe.Pointer S_p8 := len(*p8) if S_p8 > 0 { @@ -830,7 +813,7 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p8 = nil } - C_p8 := C.Plugify_CreateVector(A_p8, C.ptrdiff_t(S_p8), C.UINT8) + C_p8 := C.Plugify_ConstructVector(A_p8, C.ptrdiff_t(S_p8), C.UINT8) var A_p9 unsafe.Pointer S_p9 := len(*p9) if S_p9 > 0 { @@ -838,7 +821,7 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p9 = nil } - C_p9 := C.Plugify_CreateVector(A_p9, C.ptrdiff_t(S_p9), C.UINT16) + C_p9 := C.Plugify_ConstructVector(A_p9, C.ptrdiff_t(S_p9), C.UINT16) var A_p10 unsafe.Pointer S_p10 := len(*p10) if S_p10 > 0 { @@ -846,7 +829,7 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p10 = nil } - C_p10 := C.Plugify_CreateVector(A_p10, C.ptrdiff_t(S_p10), C.UINT32) + C_p10 := C.Plugify_ConstructVector(A_p10, C.ptrdiff_t(S_p10), C.UINT32) var A_p11 unsafe.Pointer S_p11 := len(*p11) if S_p11 > 0 { @@ -854,7 +837,7 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p11 = nil } - C_p11 := C.Plugify_CreateVector(A_p11, C.ptrdiff_t(S_p11), C.UINT64) + C_p11 := C.Plugify_ConstructVector(A_p11, C.ptrdiff_t(S_p11), C.UINT64) var A_p12 unsafe.Pointer S_p12 := len(*p12) if S_p12 > 0 { @@ -862,7 +845,7 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p12 = nil } - C_p12 := C.Plugify_CreateVector(A_p12, C.ptrdiff_t(S_p12), C.POINTER) + C_p12 := C.Plugify_ConstructVector(A_p12, C.ptrdiff_t(S_p12), C.POINTER) var A_p13 unsafe.Pointer S_p13 := len(*p13) if S_p13 > 0 { @@ -870,7 +853,7 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p13 = nil } - C_p13 := C.Plugify_CreateVector(A_p13, C.ptrdiff_t(S_p13), C.FLOAT) + C_p13 := C.Plugify_ConstructVector(A_p13, C.ptrdiff_t(S_p13), C.FLOAT) var A_p14 unsafe.Pointer S_p14 := len(*p14) if S_p14 > 0 { @@ -878,7 +861,7 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p14 = nil } - C_p14 := C.Plugify_CreateVector(A_p14, C.ptrdiff_t(S_p14), C.DOUBLE) + C_p14 := C.Plugify_ConstructVector(A_p14, C.ptrdiff_t(S_p14), C.DOUBLE) var A_p15 unsafe.Pointer S_p15 := len(*p15) if S_p15 > 0 { @@ -886,118 +869,117 @@ func ParamRefVectorsCallback(p1 *[]bool, p2 *[]int8, p3 *[]uint16, p4 *[]int8, p } else { A_p15 = nil } - C_p15 := C.Plugify_CreateVector(A_p15, C.ptrdiff_t(S_p15), C.STRING) + C_p15 := C.Plugify_ConstructVector(A_p15, C.ptrdiff_t(S_p15), C.STRING) - C.ParamRefVectorsCallback(C_p1, C_p2, C_p3, C_p4, C_p5, C_p6, C_p7, C_p8, C_p9, C_p10, C_p11, C_p12, C_p13, C_p14, C_p15) + C.ParamRefVectorsCallback(&C_p1, &C_p2, &C_p3, &C_p4, &C_p5, &C_p6, &C_p7, &C_p8, &C_p9, &C_p10, &C_p11, &C_p12, &C_p13, &C_p14, &C_p15) - L_p1 := C.Plugify_GetVectorSize(C_p1, C.BOOL) - P_p1 := C.Plugify_GetVectorData(C_p1, C.BOOL) + L_p1 := C.Plugify_GetVectorSize(&C_p1, C.BOOL) + P_p1 := C.Plugify_GetVectorData(&C_p1, C.BOOL) *p1 = make([]bool, L_p1) for i := range *p1 { (*p1)[i] = *(*bool)(unsafe.Pointer(uintptr(P_p1) + uintptr(i*C.sizeof_bool))) } - C.Plugify_DeleteVectorDataBool(P_p1) - L_p2 := C.Plugify_GetVectorSize(C_p2, C.CHAR8) - P_p2 := C.Plugify_GetVectorData(C_p2, C.CHAR8) + L_p2 := C.Plugify_GetVectorSize(&C_p2, C.CHAR8) + P_p2 := C.Plugify_GetVectorData(&C_p2, C.CHAR8) *p2 = make([]int8, L_p2) for i := range *p2 { (*p2)[i] = *(*int8)(unsafe.Pointer(uintptr(P_p2) + uintptr(i*C.sizeof_char))) } - L_p3 := C.Plugify_GetVectorSize(C_p3, C.CHAR16) - P_p3 := C.Plugify_GetVectorData(C_p3, C.CHAR16) + L_p3 := C.Plugify_GetVectorSize(&C_p3, C.CHAR16) + P_p3 := C.Plugify_GetVectorData(&C_p3, C.CHAR16) *p3 = make([]uint16, L_p3) for i := range *p3 { (*p3)[i] = *(*uint16)(unsafe.Pointer(uintptr(P_p3) + uintptr(i*C.sizeof_uint16_t))) } - L_p4 := C.Plugify_GetVectorSize(C_p4, C.INT8) - P_p4 := C.Plugify_GetVectorData(C_p4, C.INT8) + L_p4 := C.Plugify_GetVectorSize(&C_p4, C.INT8) + P_p4 := C.Plugify_GetVectorData(&C_p4, C.INT8) *p4 = make([]int8, L_p4) for i := range *p4 { (*p4)[i] = *(*int8)(unsafe.Pointer(uintptr(P_p4) + uintptr(i*C.sizeof_int8_t))) } - L_p5 := C.Plugify_GetVectorSize(C_p5, C.INT16) - P_p5 := C.Plugify_GetVectorData(C_p5, C.INT16) + L_p5 := C.Plugify_GetVectorSize(&C_p5, C.INT16) + P_p5 := C.Plugify_GetVectorData(&C_p5, C.INT16) *p5 = make([]int16, L_p5) for i := range *p5 { (*p5)[i] = *(*int16)(unsafe.Pointer(uintptr(P_p5) + uintptr(i*C.sizeof_int16_t))) } - L_p6 := C.Plugify_GetVectorSize(C_p6, C.INT32) - P_p6 := C.Plugify_GetVectorData(C_p6, C.INT32) + L_p6 := C.Plugify_GetVectorSize(&C_p6, C.INT32) + P_p6 := C.Plugify_GetVectorData(&C_p6, C.INT32) *p6 = make([]int32, L_p6) for i := range *p6 { (*p6)[i] = *(*int32)(unsafe.Pointer(uintptr(P_p6) + uintptr(i*C.sizeof_int32_t))) } - L_p7 := C.Plugify_GetVectorSize(C_p7, C.INT64) - P_p7 := C.Plugify_GetVectorData(C_p7, C.INT64) + L_p7 := C.Plugify_GetVectorSize(&C_p7, C.INT64) + P_p7 := C.Plugify_GetVectorData(&C_p7, C.INT64) *p7 = make([]int64, L_p7) for i := range *p7 { (*p7)[i] = *(*int64)(unsafe.Pointer(uintptr(P_p7) + uintptr(i*C.sizeof_int64_t))) } - L_p8 := C.Plugify_GetVectorSize(C_p8, C.UINT8) - P_p8 := C.Plugify_GetVectorData(C_p8, C.UINT8) + L_p8 := C.Plugify_GetVectorSize(&C_p8, C.UINT8) + P_p8 := C.Plugify_GetVectorData(&C_p8, C.UINT8) *p8 = make([]uint8, L_p8) for i := range *p8 { (*p8)[i] = *(*uint8)(unsafe.Pointer(uintptr(P_p8) + uintptr(i*C.sizeof_uint8_t))) } - L_p9 := C.Plugify_GetVectorSize(C_p9, C.UINT16) - P_p9 := C.Plugify_GetVectorData(C_p9, C.UINT16) + L_p9 := C.Plugify_GetVectorSize(&C_p9, C.UINT16) + P_p9 := C.Plugify_GetVectorData(&C_p9, C.UINT16) *p9 = make([]uint16, L_p9) for i := range *p9 { (*p9)[i] = *(*uint16)(unsafe.Pointer(uintptr(P_p9) + uintptr(i*C.sizeof_uint16_t))) } - L_p10 := C.Plugify_GetVectorSize(C_p10, C.UINT32) - P_p10 := C.Plugify_GetVectorData(C_p10, C.UINT32) + L_p10 := C.Plugify_GetVectorSize(&C_p10, C.UINT32) + P_p10 := C.Plugify_GetVectorData(&C_p10, C.UINT32) *p10 = make([]uint32, L_p10) for i := range *p10 { (*p10)[i] = *(*uint32)(unsafe.Pointer(uintptr(P_p10) + uintptr(i*C.sizeof_uint32_t))) } - L_p11 := C.Plugify_GetVectorSize(C_p11, C.UINT64) - P_p11 := C.Plugify_GetVectorData(C_p11, C.UINT64) + L_p11 := C.Plugify_GetVectorSize(&C_p11, C.UINT64) + P_p11 := C.Plugify_GetVectorData(&C_p11, C.UINT64) *p11 = make([]uint64, L_p11) for i := range *p11 { (*p11)[i] = *(*uint64)(unsafe.Pointer(uintptr(P_p11) + uintptr(i*C.sizeof_uint64_t))) } - L_p12 := C.Plugify_GetVectorSize(C_p12, C.POINTER) - P_p12 := C.Plugify_GetVectorData(C_p12, C.POINTER) + L_p12 := C.Plugify_GetVectorSize(&C_p12, C.POINTER) + P_p12 := C.Plugify_GetVectorData(&C_p12, C.POINTER) *p12 = make([]uintptr, L_p12) for i := range *p12 { (*p12)[i] = *(*uintptr)(unsafe.Pointer(uintptr(P_p12) + uintptr(i*C.sizeof_uintptr_t))) } - L_p13 := C.Plugify_GetVectorSize(C_p13, C.FLOAT) - P_p13 := C.Plugify_GetVectorData(C_p13, C.FLOAT) + L_p13 := C.Plugify_GetVectorSize(&C_p13, C.FLOAT) + P_p13 := C.Plugify_GetVectorData(&C_p13, C.FLOAT) *p13 = make([]float32, L_p13) for i := range *p13 { (*p13)[i] = *(*float32)(unsafe.Pointer(uintptr(P_p13) + uintptr(i*C.sizeof_float))) } - L_p14 := C.Plugify_GetVectorSize(C_p14, C.DOUBLE) - P_p14 := C.Plugify_GetVectorData(C_p14, C.DOUBLE) + L_p14 := C.Plugify_GetVectorSize(&C_p14, C.DOUBLE) + P_p14 := C.Plugify_GetVectorData(&C_p14, C.DOUBLE) *p14 = make([]float64, L_p14) for i := range *p14 { (*p14)[i] = *(*float64)(unsafe.Pointer(uintptr(P_p14) + uintptr(i*C.sizeof_double))) } - L_p15 := C.Plugify_GetVectorSize(C_p15, C.STRING) - P_p15 := C.Plugify_GetVectorData(C_p15, C.STRING) + L_p15 := C.Plugify_GetVectorSize(&C_p15, C.STRING) + P_p15 := C.Plugify_GetVectorData(&C_p15, C.STRING) *p15 = make([]string, L_p15) for i := range *p15 { (*p15)[i] = C.GoString(*(**C.char)(unsafe.Pointer(uintptr(P_p15) + uintptr(i*C.sizeof_uintptr_t)))) } C.Plugify_DeleteVectorDataCStr(P_p15) - C.Plugify_DeleteVector(C_p1, C.BOOL) - C.Plugify_DeleteVector(C_p2, C.CHAR8) - C.Plugify_DeleteVector(C_p3, C.CHAR16) - C.Plugify_DeleteVector(C_p4, C.INT8) - C.Plugify_DeleteVector(C_p5, C.INT16) - C.Plugify_DeleteVector(C_p6, C.INT32) - C.Plugify_DeleteVector(C_p7, C.INT64) - C.Plugify_DeleteVector(C_p8, C.UINT8) - C.Plugify_DeleteVector(C_p9, C.UINT16) - C.Plugify_DeleteVector(C_p10, C.UINT32) - C.Plugify_DeleteVector(C_p11, C.UINT64) - C.Plugify_DeleteVector(C_p12, C.POINTER) - C.Plugify_DeleteVector(C_p13, C.FLOAT) - C.Plugify_DeleteVector(C_p14, C.DOUBLE) - C.Plugify_DeleteVector(C_p15, C.STRING) + C.Plugify_DestroyVector(&C_p1, C.BOOL) + C.Plugify_DestroyVector(&C_p2, C.CHAR8) + C.Plugify_DestroyVector(&C_p3, C.CHAR16) + C.Plugify_DestroyVector(&C_p4, C.INT8) + C.Plugify_DestroyVector(&C_p5, C.INT16) + C.Plugify_DestroyVector(&C_p6, C.INT32) + C.Plugify_DestroyVector(&C_p7, C.INT64) + C.Plugify_DestroyVector(&C_p8, C.UINT8) + C.Plugify_DestroyVector(&C_p9, C.UINT16) + C.Plugify_DestroyVector(&C_p10, C.UINT32) + C.Plugify_DestroyVector(&C_p11, C.UINT64) + C.Plugify_DestroyVector(&C_p12, C.POINTER) + C.Plugify_DestroyVector(&C_p13, C.FLOAT) + C.Plugify_DestroyVector(&C_p14, C.DOUBLE) + C.Plugify_DestroyVector(&C_p15, C.STRING) } @@ -1020,3 +1002,696 @@ func ParamAllPrimitivesCallback(p1 bool, p2 int8, p3 uint16, p4 int8, p5 int16, result := int64(C.ParamAllPrimitivesCallback(C_p1, C_p2, C_p3, C_p4, C_p5, C_p6, C_p7, C_p8, C_p9, C_p10, C_p11, C_p12, C_p13, C_p14)) return result } + +/* +func CallFuncVoidCallback(func func) { + C_func := (func) + + C.CallFuncVoidCallback(C_func) +} + +func CallFuncBoolCallback(func func) bool { + C_func := (func) + + result := bool(C.CallFuncBoolCallback(C_func)) + return result +} + +func CallFuncChar8Callback(func func) int8 { + C_func := (func) + + result := int8(C.CallFuncChar8Callback(C_func)) + return result +} + +func CallFuncChar16Callback(func func) uint16 { + C_func := (func) + + result := uint16(C.CallFuncChar16Callback(C_func)) + return result +} + +func CallFuncInt8Callback(func func) int8 { + C_func := (func) + + result := int8(C.CallFuncInt8Callback(C_func)) + return result +} + +func CallFuncInt16Callback(func func) int16 { + C_func := (func) + + result := int16(C.CallFuncInt16Callback(C_func)) + return result +} + +func CallFuncInt32Callback(func func) int32 { + C_func := (func) + + result := int32(C.CallFuncInt32Callback(C_func)) + return result +} + +func CallFuncInt64Callback(func func) int64 { + C_func := (func) + + result := int64(C.CallFuncInt64Callback(C_func)) + return result +} + +func CallFuncUInt8Callback(func func) uint8 { + C_func := (func) + + result := uint8(C.CallFuncUInt8Callback(C_func)) + return result +} + +func CallFuncUInt16Callback(func func) uint16 { + C_func := (func) + + result := uint16(C.CallFuncUInt16Callback(C_func)) + return result +} + +func CallFuncUInt32Callback(func func) uint32 { + C_func := (func) + + result := uint32(C.CallFuncUInt32Callback(C_func)) + return result +} + +func CallFuncUInt64Callback(func func) uint64 { + C_func := (func) + + result := uint64(C.CallFuncUInt64Callback(C_func)) + return result +} + +func CallFuncPtrCallback(func func) uintptr { + C_func := (func) + + result := uintptr(C.CallFuncPtrCallback(C_func)) + return result +} + +func CallFuncFloatCallback(func func) float32 { + C_func := (func) + + result := float32(C.CallFuncFloatCallback(C_func)) + return result +} + +func CallFuncDoubleCallback(func func) float64 { + C_func := (func) + + result := float64(C.CallFuncDoubleCallback(C_func)) + return result +} + +func CallFuncStringCallback(func func) string { + C_func := (func) + + C_output := C.CallFuncStringCallback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFuncFunctionCallback(func func) uintptr { + C_func := (func) + + result := uintptr(C.CallFuncFunctionCallback(C_func)) + return result +} + +func CallFuncBoolVectorCallback(func func) []bool { + C_func := (func) + + C_output := C.CallFuncBoolVectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.BOOL) + P_output := C.Plugify_GetVectorData(&C_output, C.BOOL) + output := make([]bool, L_output) + for i := range output { + output[i] = *(*bool)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_bool))) + } + + C.Plugify_DestroyVector(&C_output, C.BOOL) + return output +} + +func CallFuncChar8VectorCallback(func func) []int8 { + C_func := (func) + + C_output := C.CallFuncChar8VectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.CHAR8) + P_output := C.Plugify_GetVectorData(&C_output, C.CHAR8) + output := make([]int8, L_output) + for i := range output { + output[i] = *(*int8)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_char))) + } + + C.Plugify_DestroyVector(&C_output, C.CHAR8) + return output +} + +func CallFuncChar16VectorCallback(func func) []uint16 { + C_func := (func) + + C_output := C.CallFuncChar16VectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.CHAR16) + P_output := C.Plugify_GetVectorData(&C_output, C.CHAR16) + output := make([]uint16, L_output) + for i := range output { + output[i] = *(*uint16)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_uint16_t))) + } + + C.Plugify_DestroyVector(&C_output, C.CHAR16) + return output +} + +func CallFuncInt8VectorCallback(func func) []int8 { + C_func := (func) + + C_output := C.CallFuncInt8VectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.INT8) + P_output := C.Plugify_GetVectorData(&C_output, C.INT8) + output := make([]int8, L_output) + for i := range output { + output[i] = *(*int8)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_int8_t))) + } + + C.Plugify_DestroyVector(&C_output, C.INT8) + return output +} + +func CallFuncInt16VectorCallback(func func) []int16 { + C_func := (func) + + C_output := C.CallFuncInt16VectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.INT16) + P_output := C.Plugify_GetVectorData(&C_output, C.INT16) + output := make([]int16, L_output) + for i := range output { + output[i] = *(*int16)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_int16_t))) + } + + C.Plugify_DestroyVector(&C_output, C.INT16) + return output +} + +func CallFuncInt32VectorCallback(func func) []int32 { + C_func := (func) + + C_output := C.CallFuncInt32VectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.INT32) + P_output := C.Plugify_GetVectorData(&C_output, C.INT32) + output := make([]int32, L_output) + for i := range output { + output[i] = *(*int32)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_int32_t))) + } + + C.Plugify_DestroyVector(&C_output, C.INT32) + return output +} + +func CallFuncInt64VectorCallback(func func) []int64 { + C_func := (func) + + C_output := C.CallFuncInt64VectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.INT64) + P_output := C.Plugify_GetVectorData(&C_output, C.INT64) + output := make([]int64, L_output) + for i := range output { + output[i] = *(*int64)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_int64_t))) + } + + C.Plugify_DestroyVector(&C_output, C.INT64) + return output +} + +func CallFuncUInt8VectorCallback(func func) []uint8 { + C_func := (func) + + C_output := C.CallFuncUInt8VectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.UINT8) + P_output := C.Plugify_GetVectorData(&C_output, C.UINT8) + output := make([]uint8, L_output) + for i := range output { + output[i] = *(*uint8)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_uint8_t))) + } + + C.Plugify_DestroyVector(&C_output, C.UINT8) + return output +} + +func CallFuncUInt16VectorCallback(func func) []uint16 { + C_func := (func) + + C_output := C.CallFuncUInt16VectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.UINT16) + P_output := C.Plugify_GetVectorData(&C_output, C.UINT16) + output := make([]uint16, L_output) + for i := range output { + output[i] = *(*uint16)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_uint16_t))) + } + + C.Plugify_DestroyVector(&C_output, C.UINT16) + return output +} + +func CallFuncUInt32VectorCallback(func func) []uint32 { + C_func := (func) + + C_output := C.CallFuncUInt32VectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.UINT32) + P_output := C.Plugify_GetVectorData(&C_output, C.UINT32) + output := make([]uint32, L_output) + for i := range output { + output[i] = *(*uint32)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_uint32_t))) + } + + C.Plugify_DestroyVector(&C_output, C.UINT32) + return output +} + +func CallFuncUInt64VectorCallback(func func) []uint64 { + C_func := (func) + + C_output := C.CallFuncUInt64VectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.UINT64) + P_output := C.Plugify_GetVectorData(&C_output, C.UINT64) + output := make([]uint64, L_output) + for i := range output { + output[i] = *(*uint64)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_uint64_t))) + } + + C.Plugify_DestroyVector(&C_output, C.UINT64) + return output +} + +func CallFuncPtrVectorCallback(func func) []uintptr { + C_func := (func) + + C_output := C.CallFuncPtrVectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.POINTER) + P_output := C.Plugify_GetVectorData(&C_output, C.POINTER) + output := make([]uintptr, L_output) + for i := range output { + output[i] = *(*uintptr)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_uintptr_t))) + } + + C.Plugify_DestroyVector(&C_output, C.POINTER) + return output +} + +func CallFuncFloatVectorCallback(func func) []float32 { + C_func := (func) + + C_output := C.CallFuncFloatVectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.FLOAT) + P_output := C.Plugify_GetVectorData(&C_output, C.FLOAT) + output := make([]float32, L_output) + for i := range output { + output[i] = *(*float32)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_float))) + } + + C.Plugify_DestroyVector(&C_output, C.FLOAT) + return output +} + +func CallFuncStringVectorCallback(func func) []string { + C_func := (func) + + C_output := C.CallFuncStringVectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.STRING) + P_output := C.Plugify_GetVectorData(&C_output, C.STRING) + output := make([]string, L_output) + for i := range output { + output[i] = C.GoString(*(**C.char)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_uintptr_t)))) + } + + C.Plugify_DeleteVectorDataCStr(P_output) + C.Plugify_DestroyVector(&C_output, C.STRING) + return output +} + +func CallFuncDoubleVectorCallback(func func) []float64 { + C_func := (func) + + C_output := C.CallFuncDoubleVectorCallback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.DOUBLE) + P_output := C.Plugify_GetVectorData(&C_output, C.DOUBLE) + output := make([]float64, L_output) + for i := range output { + output[i] = *(*float64)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_double))) + } + + C.Plugify_DestroyVector(&C_output, C.DOUBLE) + return output +} + +func CallFuncVec2Callback(func func) Vector2 { + C_func := (func) + + C_result := C.CallFuncVec2Callback(C_func) + return *(*Vector2)(unsafe.Pointer(&C_result)) +} + +func CallFuncVec3Callback(func func) Vector3 { + C_func := (func) + + C_result := C.CallFuncVec3Callback(C_func) + return *(*Vector3)(unsafe.Pointer(&C_result)) +} + +func CallFuncVec4Callback(func func) Vector4 { + C_func := (func) + + C_result := C.CallFuncVec4Callback(C_func) + return *(*Vector4)(unsafe.Pointer(&C_result)) +} + +func CallFuncMat4x4Callback(func func) Matrix4x4 { + C_func := (func) + + C_result := C.CallFuncMat4x4Callback(C_func) + return *(*Matrix4x4)(unsafe.Pointer(&C_result)) +} + +func CallFunc1Callback(func func) int32 { + C_func := (func) + + result := int32(C.CallFunc1Callback(C_func)) + return result +} + +func CallFunc2Callback(func func) int8 { + C_func := (func) + + result := int8(C.CallFunc2Callback(C_func)) + return result +} + +func CallFunc3Callback(func func) { + C_func := (func) + + C.CallFunc3Callback(C_func) +} + +func CallFunc4Callback(func func) Vector4 { + C_func := (func) + + C_result := C.CallFunc4Callback(C_func) + return *(*Vector4)(unsafe.Pointer(&C_result)) +} + +func CallFunc5Callback(func func) bool { + C_func := (func) + + result := bool(C.CallFunc5Callback(C_func)) + return result +} + +func CallFunc6Callback(func func) int64 { + C_func := (func) + + result := int64(C.CallFunc6Callback(C_func)) + return result +} + +func CallFunc7Callback(func func) float64 { + C_func := (func) + + result := float64(C.CallFunc7Callback(C_func)) + return result +} + +func CallFunc8Callback(func func) Matrix4x4 { + C_func := (func) + + C_result := C.CallFunc8Callback(C_func) + return *(*Matrix4x4)(unsafe.Pointer(&C_result)) +} + +func CallFunc9Callback(func func) { + C_func := (func) + + C.CallFunc9Callback(C_func) +} + +func CallFunc10Callback(func func) uint32 { + C_func := (func) + + result := uint32(C.CallFunc10Callback(C_func)) + return result +} + +func CallFunc11Callback(func func) uintptr { + C_func := (func) + + result := uintptr(C.CallFunc11Callback(C_func)) + return result +} + +func CallFunc12Callback(func func) bool { + C_func := (func) + + result := bool(C.CallFunc12Callback(C_func)) + return result +} + +func CallFunc13Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc13Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc14Callback(func func) []string { + C_func := (func) + + C_output := C.CallFunc14Callback(C_func) + + L_output := C.Plugify_GetVectorSize(&C_output, C.STRING) + P_output := C.Plugify_GetVectorData(&C_output, C.STRING) + output := make([]string, L_output) + for i := range output { + output[i] = C.GoString(*(**C.char)(unsafe.Pointer(uintptr(P_output) + uintptr(i * C.sizeof_uintptr_t)))) + } + + C.Plugify_DeleteVectorDataCStr(P_output) + C.Plugify_DestroyVector(&C_output, C.STRING) + return output +} + +func CallFunc15Callback(func func) int16 { + C_func := (func) + + result := int16(C.CallFunc15Callback(C_func)) + return result +} + +func CallFunc16Callback(func func) uintptr { + C_func := (func) + + result := uintptr(C.CallFunc16Callback(C_func)) + return result +} + +func CallFunc17Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc17Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc18Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc18Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc19Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc19Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc20Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc20Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc21Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc21Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc22Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc22Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc23Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc23Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc24Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc24Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc25Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc25Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc26Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc26Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc27Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc27Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc28Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc28Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc29Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc29Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc30Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc30Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc31Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc31Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} + +func CallFunc32Callback(func func) string { + C_func := (func) + + C_output := C.CallFunc32Callback(C_func) + + P_output := C.Plugify_GetStringData(&C_output) + output := C.GoString(P_output) + C.Plugify_DestroyString(&C_output) + return output +} +*/ diff --git a/test/cross_call_worker/cross_call_master/cross_call_master.h b/test/cross_call_worker/cross_call_master/cross_call_master.h index d32bd87..3607a81 100644 --- a/test/cross_call_worker/cross_call_master/cross_call_master.h +++ b/test/cross_call_worker/cross_call_master/cross_call_master.h @@ -21,45 +21,40 @@ enum DataType { STRING }; +typedef struct { char* data; size_t size; size_t cap; } String; +typedef struct { size_t size; size_t cap; void* data; } Vector; + extern void* Plugify_GetMethodPtr(const char* methodName); extern void Plugify_GetMethodPtr2(const char* methodName, void** addressDest); -extern void* Plugify_AllocateString(); -extern void* Plugify_CreateString(_GoString_ source); -extern const char* Plugify_GetStringData(void* ptr); -extern ptrdiff_t Plugify_GetStringLength(void* ptr); -extern void Plugify_AssignString(void* ptr, _GoString_ source); -extern void Plugify_FreeString(void* ptr); -extern void Plugify_DeleteString(void* ptr); +extern String Plugify_ConstructString(_GoString_ source); +extern void Plugify_DestroyString(String* string); +extern const char* Plugify_GetStringData(String* string); +extern ptrdiff_t Plugify_GetStringLength(String* string); +extern void Plugify_AssignString(String* string, _GoString_ source); -extern void* Plugify_CreateVector(void* arr, ptrdiff_t len, enum DataType type); -extern void* Plugify_AllocateVector(enum DataType type); -extern ptrdiff_t Plugify_GetVectorSize(void* ptr, enum DataType type); -extern void* Plugify_GetVectorData(void* ptr, enum DataType type); -extern void Plugify_AssignVector(void* ptr, void* arr, ptrdiff_t len, enum DataType type); -extern void Plugify_DeleteVector(void* ptr, enum DataType type); -extern void Plugify_FreeVector(void* ptr, enum DataType type); +extern Vector Plugify_ConstructVector(void* arr, ptrdiff_t len, enum DataType type); +extern void Plugify_DestroyVector(Vector* vector, enum DataType type); +extern void* Plugify_GetVectorData(Vector* vector, enum DataType type); +extern ptrdiff_t Plugify_GetVectorSize(Vector* vector, enum DataType type); +extern void Plugify_AssignVector(Vector* vector, void* arr, ptrdiff_t len, enum DataType type); -extern void Plugify_DeleteVectorDataBool(void* ptr); -extern void Plugify_DeleteVectorDataCStr(void* ptr); +extern void Plugify_DeleteVectorDataCStr(void* arr); extern void Plugify_SetGetMethodPtr(void* func); -extern void Plugify_SetAllocateString(void* func); -extern void Plugify_SetCreateString(void* func); +extern void Plugify_SetGetMethodPtr2(void* func); + +extern void Plugify_SetConstructString(void* func); +extern void Plugify_SetDestroyString(void* func); extern void Plugify_SetGetStringData(void* func); extern void Plugify_SetGetStringLength(void* func); extern void Plugify_SetAssignString(void* func); -extern void Plugify_SetFreeString(void* func); -extern void Plugify_SetDeleteString(void* func); -extern void Plugify_SetCreateVector(void* func); -extern void Plugify_SetAllocateVector(void* func); -extern void Plugify_SetGetVectorSize(void* func); +extern void Plugify_SetConstructVector(void* func); +extern void Plugify_SetDestroyVector(void* func); extern void Plugify_SetGetVectorData(void* func); +extern void Plugify_SetGetVectorSize(void* func); extern void Plugify_SetAssignVector(void* func); -extern void Plugify_SetDeleteVector(void* func); -extern void Plugify_SetFreeVector(void* func); -extern void Plugify_SetDeleteVectorDataBool(void* func); extern void Plugify_SetDeleteVectorDataCStr(void* func); //typedef struct { const char *p; ptrdiff_t n; } _GoString_; @@ -70,8 +65,8 @@ typedef struct { float x, y, z; } Vector3; typedef struct { float x, y, z, w; } Vector4; typedef struct { float m[4][4]; } Matrix4x4; -typedef void (*ReverseReturnFn)(void*); -static void ReverseReturn(void* returnString) { +typedef void (*ReverseReturnFn)(String*); +static void ReverseReturn(String* returnString) { static ReverseReturnFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.ReverseReturn", (void**)&__func); __func(returnString); @@ -172,101 +167,101 @@ static void* NoParamReturnFunctionCallback() { if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnFunctionCallback", (void**)&__func); return __func(); } -typedef void (*NoParamReturnStringCallbackFn)(void*); -static void NoParamReturnStringCallback(void* output) { +typedef String (*NoParamReturnStringCallbackFn)(); +static String NoParamReturnStringCallback() { static NoParamReturnStringCallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnStringCallback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayBoolCallbackFn)(void*); -static void NoParamReturnArrayBoolCallback(void* output) { +typedef Vector (*NoParamReturnArrayBoolCallbackFn)(); +static Vector NoParamReturnArrayBoolCallback() { static NoParamReturnArrayBoolCallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayBoolCallback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayChar8CallbackFn)(void*); -static void NoParamReturnArrayChar8Callback(void* output) { +typedef Vector (*NoParamReturnArrayChar8CallbackFn)(); +static Vector NoParamReturnArrayChar8Callback() { static NoParamReturnArrayChar8CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayChar8Callback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayChar16CallbackFn)(void*); -static void NoParamReturnArrayChar16Callback(void* output) { +typedef Vector (*NoParamReturnArrayChar16CallbackFn)(); +static Vector NoParamReturnArrayChar16Callback() { static NoParamReturnArrayChar16CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayChar16Callback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayInt8CallbackFn)(void*); -static void NoParamReturnArrayInt8Callback(void* output) { +typedef Vector (*NoParamReturnArrayInt8CallbackFn)(); +static Vector NoParamReturnArrayInt8Callback() { static NoParamReturnArrayInt8CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayInt8Callback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayInt16CallbackFn)(void*); -static void NoParamReturnArrayInt16Callback(void* output) { +typedef Vector (*NoParamReturnArrayInt16CallbackFn)(); +static Vector NoParamReturnArrayInt16Callback() { static NoParamReturnArrayInt16CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayInt16Callback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayInt32CallbackFn)(void*); -static void NoParamReturnArrayInt32Callback(void* output) { +typedef Vector (*NoParamReturnArrayInt32CallbackFn)(); +static Vector NoParamReturnArrayInt32Callback() { static NoParamReturnArrayInt32CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayInt32Callback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayInt64CallbackFn)(void*); -static void NoParamReturnArrayInt64Callback(void* output) { +typedef Vector (*NoParamReturnArrayInt64CallbackFn)(); +static Vector NoParamReturnArrayInt64Callback() { static NoParamReturnArrayInt64CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayInt64Callback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayUInt8CallbackFn)(void*); -static void NoParamReturnArrayUInt8Callback(void* output) { +typedef Vector (*NoParamReturnArrayUInt8CallbackFn)(); +static Vector NoParamReturnArrayUInt8Callback() { static NoParamReturnArrayUInt8CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayUInt8Callback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayUInt16CallbackFn)(void*); -static void NoParamReturnArrayUInt16Callback(void* output) { +typedef Vector (*NoParamReturnArrayUInt16CallbackFn)(); +static Vector NoParamReturnArrayUInt16Callback() { static NoParamReturnArrayUInt16CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayUInt16Callback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayUInt32CallbackFn)(void*); -static void NoParamReturnArrayUInt32Callback(void* output) { +typedef Vector (*NoParamReturnArrayUInt32CallbackFn)(); +static Vector NoParamReturnArrayUInt32Callback() { static NoParamReturnArrayUInt32CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayUInt32Callback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayUInt64CallbackFn)(void*); -static void NoParamReturnArrayUInt64Callback(void* output) { +typedef Vector (*NoParamReturnArrayUInt64CallbackFn)(); +static Vector NoParamReturnArrayUInt64Callback() { static NoParamReturnArrayUInt64CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayUInt64Callback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayPointerCallbackFn)(void*); -static void NoParamReturnArrayPointerCallback(void* output) { +typedef Vector (*NoParamReturnArrayPointerCallbackFn)(); +static Vector NoParamReturnArrayPointerCallback() { static NoParamReturnArrayPointerCallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayPointerCallback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayFloatCallbackFn)(void*); -static void NoParamReturnArrayFloatCallback(void* output) { +typedef Vector (*NoParamReturnArrayFloatCallbackFn)(); +static Vector NoParamReturnArrayFloatCallback() { static NoParamReturnArrayFloatCallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayFloatCallback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayDoubleCallbackFn)(void*); -static void NoParamReturnArrayDoubleCallback(void* output) { +typedef Vector (*NoParamReturnArrayDoubleCallbackFn)(); +static Vector NoParamReturnArrayDoubleCallback() { static NoParamReturnArrayDoubleCallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayDoubleCallback", (void**)&__func); - return __func(output); + return __func(); } -typedef void (*NoParamReturnArrayStringCallbackFn)(void*); -static void NoParamReturnArrayStringCallback(void* output) { +typedef Vector (*NoParamReturnArrayStringCallbackFn)(); +static Vector NoParamReturnArrayStringCallback() { static NoParamReturnArrayStringCallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.NoParamReturnArrayStringCallback", (void**)&__func); - return __func(output); + return __func(); } typedef Vector2 (*NoParamReturnVector2CallbackFn)(); static Vector2 NoParamReturnVector2Callback() { @@ -316,38 +311,38 @@ static void Param4Callback(int32_t a, float b, double c, Vector4* d) { if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.Param4Callback", (void**)&__func); __func(a, b, c, d); } -typedef void (*Param5CallbackFn)(int32_t, float, double, Vector4*, void*); -static void Param5Callback(int32_t a, float b, double c, Vector4* d, void* e) { +typedef void (*Param5CallbackFn)(int32_t, float, double, Vector4*, Vector*); +static void Param5Callback(int32_t a, float b, double c, Vector4* d, Vector* e) { static Param5CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.Param5Callback", (void**)&__func); __func(a, b, c, d, e); } -typedef void (*Param6CallbackFn)(int32_t, float, double, Vector4*, void*, char); -static void Param6Callback(int32_t a, float b, double c, Vector4* d, void* e, char f) { +typedef void (*Param6CallbackFn)(int32_t, float, double, Vector4*, Vector*, char); +static void Param6Callback(int32_t a, float b, double c, Vector4* d, Vector* e, char f) { static Param6CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.Param6Callback", (void**)&__func); __func(a, b, c, d, e, f); } -typedef void (*Param7CallbackFn)(int32_t, float, double, Vector4*, void*, char, void*); -static void Param7Callback(int32_t a, float b, double c, Vector4* d, void* e, char f, void* g) { +typedef void (*Param7CallbackFn)(int32_t, float, double, Vector4*, Vector*, char, String*); +static void Param7Callback(int32_t a, float b, double c, Vector4* d, Vector* e, char f, String* g) { static Param7CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.Param7Callback", (void**)&__func); __func(a, b, c, d, e, f, g); } -typedef void (*Param8CallbackFn)(int32_t, float, double, Vector4*, void*, char, void*, uint16_t); -static void Param8Callback(int32_t a, float b, double c, Vector4* d, void* e, char f, void* g, uint16_t h) { +typedef void (*Param8CallbackFn)(int32_t, float, double, Vector4*, Vector*, char, String*, uint16_t); +static void Param8Callback(int32_t a, float b, double c, Vector4* d, Vector* e, char f, String* g, uint16_t h) { static Param8CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.Param8Callback", (void**)&__func); __func(a, b, c, d, e, f, g, h); } -typedef void (*Param9CallbackFn)(int32_t, float, double, Vector4*, void*, char, void*, uint16_t, int16_t); -static void Param9Callback(int32_t a, float b, double c, Vector4* d, void* e, char f, void* g, uint16_t h, int16_t k) { +typedef void (*Param9CallbackFn)(int32_t, float, double, Vector4*, Vector*, char, String*, uint16_t, int16_t); +static void Param9Callback(int32_t a, float b, double c, Vector4* d, Vector* e, char f, String* g, uint16_t h, int16_t k) { static Param9CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.Param9Callback", (void**)&__func); __func(a, b, c, d, e, f, g, h, k); } -typedef void (*Param10CallbackFn)(int32_t, float, double, Vector4*, void*, char, void*, uint16_t, int16_t, uintptr_t); -static void Param10Callback(int32_t a, float b, double c, Vector4* d, void* e, char f, void* g, uint16_t h, int16_t k, uintptr_t l) { +typedef void (*Param10CallbackFn)(int32_t, float, double, Vector4*, Vector*, char, String*, uint16_t, int16_t, uintptr_t); +static void Param10Callback(int32_t a, float b, double c, Vector4* d, Vector* e, char f, String* g, uint16_t h, int16_t k, uintptr_t l) { static Param10CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.Param10Callback", (void**)&__func); __func(a, b, c, d, e, f, g, h, k, l); @@ -376,44 +371,44 @@ static void ParamRef4Callback(int32_t* a, float* b, double* c, Vector4* d) { if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.ParamRef4Callback", (void**)&__func); __func(a, b, c, d); } -typedef void (*ParamRef5CallbackFn)(int32_t*, float*, double*, Vector4*, void*); -static void ParamRef5Callback(int32_t* a, float* b, double* c, Vector4* d, void* e) { +typedef void (*ParamRef5CallbackFn)(int32_t*, float*, double*, Vector4*, Vector*); +static void ParamRef5Callback(int32_t* a, float* b, double* c, Vector4* d, Vector* e) { static ParamRef5CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.ParamRef5Callback", (void**)&__func); __func(a, b, c, d, e); } -typedef void (*ParamRef6CallbackFn)(int32_t*, float*, double*, Vector4*, void*, char*); -static void ParamRef6Callback(int32_t* a, float* b, double* c, Vector4* d, void* e, char* f) { +typedef void (*ParamRef6CallbackFn)(int32_t*, float*, double*, Vector4*, Vector*, char*); +static void ParamRef6Callback(int32_t* a, float* b, double* c, Vector4* d, Vector* e, char* f) { static ParamRef6CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.ParamRef6Callback", (void**)&__func); __func(a, b, c, d, e, f); } -typedef void (*ParamRef7CallbackFn)(int32_t*, float*, double*, Vector4*, void*, char*, void*); -static void ParamRef7Callback(int32_t* a, float* b, double* c, Vector4* d, void* e, char* f, void* g) { +typedef void (*ParamRef7CallbackFn)(int32_t*, float*, double*, Vector4*, Vector*, char*, String*); +static void ParamRef7Callback(int32_t* a, float* b, double* c, Vector4* d, Vector* e, char* f, String* g) { static ParamRef7CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.ParamRef7Callback", (void**)&__func); __func(a, b, c, d, e, f, g); } -typedef void (*ParamRef8CallbackFn)(int32_t*, float*, double*, Vector4*, void*, char*, void*, uint16_t*); -static void ParamRef8Callback(int32_t* a, float* b, double* c, Vector4* d, void* e, char* f, void* g, uint16_t* h) { +typedef void (*ParamRef8CallbackFn)(int32_t*, float*, double*, Vector4*, Vector*, char*, String*, uint16_t*); +static void ParamRef8Callback(int32_t* a, float* b, double* c, Vector4* d, Vector* e, char* f, String* g, uint16_t* h) { static ParamRef8CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.ParamRef8Callback", (void**)&__func); __func(a, b, c, d, e, f, g, h); } -typedef void (*ParamRef9CallbackFn)(int32_t*, float*, double*, Vector4*, void*, char*, void*, uint16_t*, int16_t*); -static void ParamRef9Callback(int32_t* a, float* b, double* c, Vector4* d, void* e, char* f, void* g, uint16_t* h, int16_t* k) { +typedef void (*ParamRef9CallbackFn)(int32_t*, float*, double*, Vector4*, Vector*, char*, String*, uint16_t*, int16_t*); +static void ParamRef9Callback(int32_t* a, float* b, double* c, Vector4* d, Vector* e, char* f, String* g, uint16_t* h, int16_t* k) { static ParamRef9CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.ParamRef9Callback", (void**)&__func); __func(a, b, c, d, e, f, g, h, k); } -typedef void (*ParamRef10CallbackFn)(int32_t*, float*, double*, Vector4*, void*, char*, void*, uint16_t*, int16_t*, uintptr_t*); -static void ParamRef10Callback(int32_t* a, float* b, double* c, Vector4* d, void* e, char* f, void* g, uint16_t* h, int16_t* k, uintptr_t* l) { +typedef void (*ParamRef10CallbackFn)(int32_t*, float*, double*, Vector4*, Vector*, char*, String*, uint16_t*, int16_t*, uintptr_t*); +static void ParamRef10Callback(int32_t* a, float* b, double* c, Vector4* d, Vector* e, char* f, String* g, uint16_t* h, int16_t* k, uintptr_t* l) { static ParamRef10CallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.ParamRef10Callback", (void**)&__func); __func(a, b, c, d, e, f, g, h, k, l); } -typedef void (*ParamRefVectorsCallbackFn)(void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*, void*); -static void ParamRefVectorsCallback(void* p1, void* p2, void* p3, void* p4, void* p5, void* p6, void* p7, void* p8, void* p9, void* p10, void* p11, void* p12, void* p13, void* p14, void* p15) { +typedef void (*ParamRefVectorsCallbackFn)(Vector*, Vector*, Vector*, Vector*, Vector*, Vector*, Vector*, Vector*, Vector*, Vector*, Vector*, Vector*, Vector*, Vector*, Vector*); +static void ParamRefVectorsCallback(Vector* p1, Vector* p2, Vector* p3, Vector* p4, Vector* p5, Vector* p6, Vector* p7, Vector* p8, Vector* p9, Vector* p10, Vector* p11, Vector* p12, Vector* p13, Vector* p14, Vector* p15) { static ParamRefVectorsCallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.ParamRefVectorsCallback", (void**)&__func); __func(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15); @@ -423,4 +418,413 @@ static int64_t ParamAllPrimitivesCallback(bool p1, char p2, uint16_t p3, int8_t static ParamAllPrimitivesCallbackFn __func = NULL; if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.ParamAllPrimitivesCallback", (void**)&__func); return __func(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14); -} +}/* +typedef void (*CallFuncVoidCallbackFn)(delegate); +static void CallFuncVoidCallback(delegate func) { + static CallFuncVoidCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncVoidCallback", (void**)&__func); + __func(func); +} +typedef bool (*CallFuncBoolCallbackFn)(delegate); +static bool CallFuncBoolCallback(delegate func) { + static CallFuncBoolCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncBoolCallback", (void**)&__func); + return __func(func); +} +typedef char (*CallFuncChar8CallbackFn)(delegate); +static char CallFuncChar8Callback(delegate func) { + static CallFuncChar8CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncChar8Callback", (void**)&__func); + return __func(func); +} +typedef uint16_t (*CallFuncChar16CallbackFn)(delegate); +static uint16_t CallFuncChar16Callback(delegate func) { + static CallFuncChar16CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncChar16Callback", (void**)&__func); + return __func(func); +} +typedef int8_t (*CallFuncInt8CallbackFn)(delegate); +static int8_t CallFuncInt8Callback(delegate func) { + static CallFuncInt8CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncInt8Callback", (void**)&__func); + return __func(func); +} +typedef int16_t (*CallFuncInt16CallbackFn)(delegate); +static int16_t CallFuncInt16Callback(delegate func) { + static CallFuncInt16CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncInt16Callback", (void**)&__func); + return __func(func); +} +typedef int32_t (*CallFuncInt32CallbackFn)(delegate); +static int32_t CallFuncInt32Callback(delegate func) { + static CallFuncInt32CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncInt32Callback", (void**)&__func); + return __func(func); +} +typedef int64_t (*CallFuncInt64CallbackFn)(delegate); +static int64_t CallFuncInt64Callback(delegate func) { + static CallFuncInt64CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncInt64Callback", (void**)&__func); + return __func(func); +} +typedef uint8_t (*CallFuncUInt8CallbackFn)(delegate); +static uint8_t CallFuncUInt8Callback(delegate func) { + static CallFuncUInt8CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncUInt8Callback", (void**)&__func); + return __func(func); +} +typedef uint16_t (*CallFuncUInt16CallbackFn)(delegate); +static uint16_t CallFuncUInt16Callback(delegate func) { + static CallFuncUInt16CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncUInt16Callback", (void**)&__func); + return __func(func); +} +typedef uint32_t (*CallFuncUInt32CallbackFn)(delegate); +static uint32_t CallFuncUInt32Callback(delegate func) { + static CallFuncUInt32CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncUInt32Callback", (void**)&__func); + return __func(func); +} +typedef uint64_t (*CallFuncUInt64CallbackFn)(delegate); +static uint64_t CallFuncUInt64Callback(delegate func) { + static CallFuncUInt64CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncUInt64Callback", (void**)&__func); + return __func(func); +} +typedef uintptr_t (*CallFuncPtrCallbackFn)(delegate); +static uintptr_t CallFuncPtrCallback(delegate func) { + static CallFuncPtrCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncPtrCallback", (void**)&__func); + return __func(func); +} +typedef float (*CallFuncFloatCallbackFn)(delegate); +static float CallFuncFloatCallback(delegate func) { + static CallFuncFloatCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncFloatCallback", (void**)&__func); + return __func(func); +} +typedef double (*CallFuncDoubleCallbackFn)(delegate); +static double CallFuncDoubleCallback(delegate func) { + static CallFuncDoubleCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncDoubleCallback", (void**)&__func); + return __func(func); +} +typedef String (*CallFuncStringCallbackFn)(delegate); +static String CallFuncStringCallback(delegate func) { + static CallFuncStringCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncStringCallback", (void**)&__func); + return __func(func); +} +typedef uintptr_t (*CallFuncFunctionCallbackFn)(delegate); +static uintptr_t CallFuncFunctionCallback(delegate func) { + static CallFuncFunctionCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncFunctionCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncBoolVectorCallbackFn)(delegate); +static Vector CallFuncBoolVectorCallback(delegate func) { + static CallFuncBoolVectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncBoolVectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncChar8VectorCallbackFn)(delegate); +static Vector CallFuncChar8VectorCallback(delegate func) { + static CallFuncChar8VectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncChar8VectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncChar16VectorCallbackFn)(delegate); +static Vector CallFuncChar16VectorCallback(delegate func) { + static CallFuncChar16VectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncChar16VectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncInt8VectorCallbackFn)(delegate); +static Vector CallFuncInt8VectorCallback(delegate func) { + static CallFuncInt8VectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncInt8VectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncInt16VectorCallbackFn)(delegate); +static Vector CallFuncInt16VectorCallback(delegate func) { + static CallFuncInt16VectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncInt16VectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncInt32VectorCallbackFn)(delegate); +static Vector CallFuncInt32VectorCallback(delegate func) { + static CallFuncInt32VectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncInt32VectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncInt64VectorCallbackFn)(delegate); +static Vector CallFuncInt64VectorCallback(delegate func) { + static CallFuncInt64VectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncInt64VectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncUInt8VectorCallbackFn)(delegate); +static Vector CallFuncUInt8VectorCallback(delegate func) { + static CallFuncUInt8VectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncUInt8VectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncUInt16VectorCallbackFn)(delegate); +static Vector CallFuncUInt16VectorCallback(delegate func) { + static CallFuncUInt16VectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncUInt16VectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncUInt32VectorCallbackFn)(delegate); +static Vector CallFuncUInt32VectorCallback(delegate func) { + static CallFuncUInt32VectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncUInt32VectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncUInt64VectorCallbackFn)(delegate); +static Vector CallFuncUInt64VectorCallback(delegate func) { + static CallFuncUInt64VectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncUInt64VectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncPtrVectorCallbackFn)(delegate); +static Vector CallFuncPtrVectorCallback(delegate func) { + static CallFuncPtrVectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncPtrVectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncFloatVectorCallbackFn)(delegate); +static Vector CallFuncFloatVectorCallback(delegate func) { + static CallFuncFloatVectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncFloatVectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncStringVectorCallbackFn)(delegate); +static Vector CallFuncStringVectorCallback(delegate func) { + static CallFuncStringVectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncStringVectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFuncDoubleVectorCallbackFn)(delegate); +static Vector CallFuncDoubleVectorCallback(delegate func) { + static CallFuncDoubleVectorCallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncDoubleVectorCallback", (void**)&__func); + return __func(func); +} +typedef Vector2 (*CallFuncVec2CallbackFn)(delegate); +static Vector2 CallFuncVec2Callback(delegate func) { + static CallFuncVec2CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncVec2Callback", (void**)&__func); + return __func(func); +} +typedef Vector3 (*CallFuncVec3CallbackFn)(delegate); +static Vector3 CallFuncVec3Callback(delegate func) { + static CallFuncVec3CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncVec3Callback", (void**)&__func); + return __func(func); +} +typedef Vector4 (*CallFuncVec4CallbackFn)(delegate); +static Vector4 CallFuncVec4Callback(delegate func) { + static CallFuncVec4CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncVec4Callback", (void**)&__func); + return __func(func); +} +typedef Matrix4x4 (*CallFuncMat4x4CallbackFn)(delegate); +static Matrix4x4 CallFuncMat4x4Callback(delegate func) { + static CallFuncMat4x4CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFuncMat4x4Callback", (void**)&__func); + return __func(func); +} +typedef int32_t (*CallFunc1CallbackFn)(delegate); +static int32_t CallFunc1Callback(delegate func) { + static CallFunc1CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc1Callback", (void**)&__func); + return __func(func); +} +typedef char (*CallFunc2CallbackFn)(delegate); +static char CallFunc2Callback(delegate func) { + static CallFunc2CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc2Callback", (void**)&__func); + return __func(func); +} +typedef void (*CallFunc3CallbackFn)(delegate); +static void CallFunc3Callback(delegate func) { + static CallFunc3CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc3Callback", (void**)&__func); + __func(func); +} +typedef Vector4 (*CallFunc4CallbackFn)(delegate); +static Vector4 CallFunc4Callback(delegate func) { + static CallFunc4CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc4Callback", (void**)&__func); + return __func(func); +} +typedef bool (*CallFunc5CallbackFn)(delegate); +static bool CallFunc5Callback(delegate func) { + static CallFunc5CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc5Callback", (void**)&__func); + return __func(func); +} +typedef int64_t (*CallFunc6CallbackFn)(delegate); +static int64_t CallFunc6Callback(delegate func) { + static CallFunc6CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc6Callback", (void**)&__func); + return __func(func); +} +typedef double (*CallFunc7CallbackFn)(delegate); +static double CallFunc7Callback(delegate func) { + static CallFunc7CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc7Callback", (void**)&__func); + return __func(func); +} +typedef Matrix4x4 (*CallFunc8CallbackFn)(delegate); +static Matrix4x4 CallFunc8Callback(delegate func) { + static CallFunc8CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc8Callback", (void**)&__func); + return __func(func); +} +typedef void (*CallFunc9CallbackFn)(delegate); +static void CallFunc9Callback(delegate func) { + static CallFunc9CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc9Callback", (void**)&__func); + __func(func); +} +typedef uint32_t (*CallFunc10CallbackFn)(delegate); +static uint32_t CallFunc10Callback(delegate func) { + static CallFunc10CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc10Callback", (void**)&__func); + return __func(func); +} +typedef uintptr_t (*CallFunc11CallbackFn)(delegate); +static uintptr_t CallFunc11Callback(delegate func) { + static CallFunc11CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc11Callback", (void**)&__func); + return __func(func); +} +typedef bool (*CallFunc12CallbackFn)(delegate); +static bool CallFunc12Callback(delegate func) { + static CallFunc12CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc12Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc13CallbackFn)(delegate); +static String CallFunc13Callback(delegate func) { + static CallFunc13CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc13Callback", (void**)&__func); + return __func(func); +} +typedef Vector (*CallFunc14CallbackFn)(delegate); +static Vector CallFunc14Callback(delegate func) { + static CallFunc14CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc14Callback", (void**)&__func); + return __func(func); +} +typedef int16_t (*CallFunc15CallbackFn)(delegate); +static int16_t CallFunc15Callback(delegate func) { + static CallFunc15CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc15Callback", (void**)&__func); + return __func(func); +} +typedef uintptr_t (*CallFunc16CallbackFn)(delegate); +static uintptr_t CallFunc16Callback(delegate func) { + static CallFunc16CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc16Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc17CallbackFn)(delegate); +static String CallFunc17Callback(delegate func) { + static CallFunc17CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc17Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc18CallbackFn)(delegate); +static String CallFunc18Callback(delegate func) { + static CallFunc18CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc18Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc19CallbackFn)(delegate); +static String CallFunc19Callback(delegate func) { + static CallFunc19CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc19Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc20CallbackFn)(delegate); +static String CallFunc20Callback(delegate func) { + static CallFunc20CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc20Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc21CallbackFn)(delegate); +static String CallFunc21Callback(delegate func) { + static CallFunc21CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc21Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc22CallbackFn)(delegate); +static String CallFunc22Callback(delegate func) { + static CallFunc22CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc22Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc23CallbackFn)(delegate); +static String CallFunc23Callback(delegate func) { + static CallFunc23CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc23Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc24CallbackFn)(delegate); +static String CallFunc24Callback(delegate func) { + static CallFunc24CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc24Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc25CallbackFn)(delegate); +static String CallFunc25Callback(delegate func) { + static CallFunc25CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc25Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc26CallbackFn)(delegate); +static String CallFunc26Callback(delegate func) { + static CallFunc26CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc26Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc27CallbackFn)(delegate); +static String CallFunc27Callback(delegate func) { + static CallFunc27CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc27Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc28CallbackFn)(delegate); +static String CallFunc28Callback(delegate func) { + static CallFunc28CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc28Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc29CallbackFn)(delegate); +static String CallFunc29Callback(delegate func) { + static CallFunc29CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc29Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc30CallbackFn)(delegate); +static String CallFunc30Callback(delegate func) { + static CallFunc30CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc30Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc31CallbackFn)(delegate); +static String CallFunc31Callback(delegate func) { + static CallFunc31CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc31Callback", (void**)&__func); + return __func(func); +} +typedef String (*CallFunc32CallbackFn)(delegate); +static String CallFunc32Callback(delegate func) { + static CallFunc32CallbackFn __func = NULL; + if (__func == NULL) Plugify_GetMethodPtr2("cross_call_master.CallFunc32Callback", (void**)&__func); + return __func(func); +} +*/ \ No newline at end of file diff --git a/test/cross_call_worker/cross_call_worker.dll b/test/cross_call_worker/cross_call_worker.dll new file mode 100644 index 0000000..e48fede Binary files /dev/null and b/test/cross_call_worker/cross_call_worker.dll differ