2024-10-16 18:05:07 +13:00
|
|
|
package libmiqt
|
2024-08-18 17:48:17 +12:00
|
|
|
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
2024-09-14 19:31:39 +12:00
|
|
|
/*
|
|
|
|
|
2024-10-16 18:05:07 +13:00
|
|
|
#include "libmiqt.h"
|
2024-09-14 19:31:39 +12:00
|
|
|
|
|
|
|
struct miqt_string* miqt_strdupg(_GoString_ gs) {
|
|
|
|
return miqt_strdup(_GoStringPtr(gs), _GoStringLen(gs));
|
|
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
|
|
import "C"
|
|
|
|
|
2024-08-18 19:02:32 +12:00
|
|
|
import (
|
2024-08-24 11:46:26 +12:00
|
|
|
"unsafe"
|
2024-08-18 19:02:32 +12:00
|
|
|
)
|
|
|
|
|
2024-10-16 18:05:07 +13:00
|
|
|
// Strdupg will strdup a Go string into a miqt_string*.
|
2024-09-14 19:31:39 +12:00
|
|
|
// It is typed as returning an unsafe.Pointer because Cgo types cannot be shared
|
|
|
|
// across Go file boundaries.
|
2024-10-16 18:05:07 +13:00
|
|
|
func Strdupg(s string) unsafe.Pointer {
|
2024-09-14 19:31:39 +12:00
|
|
|
return unsafe.Pointer(C.miqt_strdupg(s))
|
2024-08-18 17:48:17 +12:00
|
|
|
}
|