use g_strdup() for connect() user function with string result

This commit is contained in:
Stefan Salewski 2021-07-21 09:05:47 +02:00
commit 67b3cb3777
2 changed files with 7 additions and 3 deletions

View file

@ -200,7 +200,10 @@ proc $1$2 {.cdecl.} =
if resl == "int32": if resl == "int32":
resu.add(".int32") resu.add(".int32")
if resl == "cstring":
resu.add(".g_strdup")
r1s.add(resu & "\n") r1s.add(resu & "\n")
all = all.replace(")", "; user_data: pointer)") all = all.replace(")", "; user_data: pointer)")

View file

@ -1,6 +1,6 @@
# High level gobject-introspection based GTK4/GTK3 bindings for the Nim programming language # High level gobject-introspection based GTK4/GTK3 bindings for the Nim programming language
# nimpretty --maxLineLen:130 gen.nim # nimpretty --maxLineLen:130 gen.nim
# v 0.9.4 2021-JUL-19 # v 0.9.4 2021-JUL-21
# (c) S. Salewski 2018, 2019, 2020, 2021 # (c) S. Salewski 2018, 2019, 2020, 2021
# usefull for finding death code: # usefull for finding death code:
@ -1862,7 +1862,7 @@ proc writeMethod(info: GIBaseInfo; minfo: GIFunctionInfo) =
# export only low level symbols that are needed internally -- maybe we should export only a private name for them # export only low level symbols that are needed internally -- maybe we should export only a private name for them
if run == 0 and not tryOut2Ret: if run == 0 and not tryOut2Ret:
if sym in ["g_quark_from_static_string", "g_error_free", "g_object_get_qdata", "g_object_ref_sink", "g_object_unref", "g_param_spec_ref_sink", if sym in ["g_quark_from_static_string", "g_error_free", "g_object_get_qdata", "g_object_ref_sink", "g_object_unref", "g_param_spec_ref_sink",
"g_timeout_add_full", "g_object_is_floating", "gst_bus_add_watch_full", "g_object_ref", "g_date_time_format", "gdk_event_ref", "g_timeout_add_full", "g_object_is_floating", "gst_bus_add_watch_full", "g_object_ref", "g_date_time_format", "gdk_event_ref", "g_strdup",
"g_type_from_name", "g_type_check_instance_is_a", "g_idle_add_full", "g_quark_try_string", "vte_regex_unref", "gtk_expression_ref", "g_type_from_name", "g_type_check_instance_is_a", "g_idle_add_full", "g_quark_try_string", "vte_regex_unref", "gtk_expression_ref",
"gtk_builder_get_object", "g_action_map_add_action", "gtk_drawing_area_set_draw_func", "g_io_add_watch_full"]: "gtk_builder_get_object", "g_action_map_add_action", "gtk_drawing_area_set_draw_func", "g_io_add_watch_full"]:
methodBuffer.write("\nproc " & sym & EM & pars.plist) methodBuffer.write("\nproc " & sym & EM & pars.plist)
@ -3269,6 +3269,7 @@ proc seq2GSList*[T](s: seq[T]): ptr glib.SList =
#include gimplgobj #include gimplgobj
include gimplglib include gimplglib
export glib.g_strdup
""" """