diff --git a/link_windows_386.go b/link_windows_386.go index 3ea6183..f223ae1 100644 --- a/link_windows_386.go +++ b/link_windows_386.go @@ -2,7 +2,7 @@ package ui -// #cgo LDFLAGS: ${SRCDIR}/static_windows_386.o ${SRCDIR}/libui_windows_386.a ${SRCDIR}/libui_windows_386.res.o +// #cgo LDFLAGS: ${SRCDIR}/libui_windows_386.a ${SRCDIR}/libui_windows_386.res.o // /* note the order; also note the lack of uuid */ // #cgo LDFLAGS: -luser32 -lkernel32 -lusp10 -lgdi32 -lcomctl32 -luxtheme -lmsimg32 -lcomdlg32 -ld2d1 -ldwrite -lole32 -loleaut32 -loleacc -static -static-libgcc -static-libstdc++ import "C" diff --git a/link_windows_amd64.go b/link_windows_amd64.go index 1992ae7..515bbd1 100644 --- a/link_windows_amd64.go +++ b/link_windows_amd64.go @@ -2,7 +2,7 @@ package ui -// #cgo LDFLAGS: ${SRCDIR}/static_windows_amd64.o ${SRCDIR}/libui_windows_amd64.a ${SRCDIR}/libui_windows_amd64.res.o +// #cgo LDFLAGS: ${SRCDIR}/libui_windows_amd64.a ${SRCDIR}/libui_windows_amd64.res.o // /* note the order; also note the lack of uuid */ // #cgo LDFLAGS: -luser32 -lkernel32 -lusp10 -lgdi32 -lcomctl32 -luxtheme -lmsimg32 -lcomdlg32 -ld2d1 -ldwrite -lole32 -loleaut32 -loleacc -static -static-libgcc -static-libstdc++ import "C" diff --git a/static_windows_386.o b/static_windows_386.syso similarity index 100% rename from static_windows_386.o rename to static_windows_386.syso diff --git a/static_windows_amd64.o b/static_windows_amd64.syso similarity index 100% rename from static_windows_amd64.o rename to static_windows_amd64.syso diff --git a/stddialogs.go b/stddialogs.go index 7954512..0ff8a01 100644 --- a/stddialogs.go +++ b/stddialogs.go @@ -8,30 +8,34 @@ import "C" // TODO func MsgBoxError(w *Window, title string, description string) { ctitle := C.CString(title) + defer freestr(ctitle) cdescription := C.CString(description) + defer freestr(cdescription) C.uiMsgBoxError(w.w, ctitle, cdescription) - freestr(ctitle) - freestr(cdescription) } func OpenFile(w *Window) string { cname := C.uiOpenFile(w.w) - name := C.GoString(cname) - C.uiFreeText(cname) - return name + if cname == nil { + return "" + } + defer C.uiFreeText(cname) + return C.GoString(cname) } func SaveFile(w *Window) string { cname := C.uiSaveFile(w.w) - name := C.GoString(cname) - C.uiFreeText(cname) - return name + if cname == nil { + return "" + } + defer C.uiFreeText(cname) + return C.GoString(cname) } func MsgBox(w *Window, title string, description string) { ctitle := C.CString(title) + defer freestr(ctitle) cdescription := C.CString(description) + defer freestr(cdescription) C.uiMsgBox(w.w, ctitle, cdescription) - freestr(ctitle) - freestr(cdescription) }