(method ComponentDefinitionMethod, w LanguageWriter, NameSpace string, ClassName string, isGlobal bool)
| 412 | } |
| 413 | |
| 414 | func writeFunctionTableMethod(method ComponentDefinitionMethod, w LanguageWriter, NameSpace string, ClassName string, isGlobal bool) error { |
| 415 | linearMethodName := "" |
| 416 | if (isGlobal) { |
| 417 | linearMethodName = strings.ToLower(NameSpace + "_" + method.MethodName) |
| 418 | } else { |
| 419 | linearMethodName = strings.ToLower(NameSpace + "_" + ClassName + "_" + method.MethodName) |
| 420 | } |
| 421 | |
| 422 | params, err := getMethodCParams(method, NameSpace, ClassName, isGlobal) |
| 423 | if err != nil { |
| 424 | return err |
| 425 | } |
| 426 | |
| 427 | w.Writeln("err = symbolLookupMethod(ctypes.c_char_p(str.encode(\"%s\")), methodAddress)", linearMethodName) |
| 428 | w.Writeln("if err != 0:") |
| 429 | w.Writeln(" raise E%sException(ErrorCodes.COULDNOTLOADLIBRARY, str(err))", NameSpace) |
| 430 | w.Writeln("methodType = ctypes.CFUNCTYPE(ctypes.c_int32, " + params + ")") |
| 431 | w.Writeln("self.lib.%s = methodType(int(methodAddress.value))", linearMethodName) |
| 432 | w.Writeln("") |
| 433 | return nil |
| 434 | } |
| 435 | |
| 436 | func getMethodCParams(method ComponentDefinitionMethod, NameSpace string, ClassName string, isGlobal bool) (string, error) { |
| 437 | parameters := "" |
no test coverage detected