Matas Lauzadis
01/30/2025, 6:35 PMMap<String, String>
)? I was hoping to use the `extern char **environ` but it's not available in platform.posix
. Is it accessible in a different way? Do I need to set this up in a cinterop to get access?ephemient
01/30/2025, 7:36 PM(must be declared in the user programenviron
_GNU_SOURCE
won't have any impact on platform.posix
as it was built as part of stdlib, not in your project)ephemient
01/30/2025, 7:46 PMextern char **environ
in a cinterop def file, you can map it to a Map<String, String>
easily, e.g.
buildMap {
for (i in 0..Int.MAX_VALUE) {
val kv = environ?.get(i)?.toKString() ?: break
this[kv.substringBefore('=')] = kv.substringAfter('=', "")
}
}
Matas Lauzadis
01/30/2025, 7:52 PM_GNU_SOURCE
feature test macro is defined"
Thanks for setting me straight