File tree Expand file tree Collapse file tree 2 files changed +27
-6
lines changed
posix/src/posixInterop/cinterop Expand file tree Collapse file tree 2 files changed +27
-6
lines changed Original file line number Diff line number Diff line change 55
66import aws.sdk.kotlin.gradle.kmp.NATIVE_ENABLED
77import aws.sdk.kotlin.gradle.util.typedProp
8+ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
89import org.jetbrains.kotlin.konan.target.HostManager
910import java.nio.file.Files
1011import java.nio.file.Paths
@@ -33,6 +34,7 @@ kotlin {
3334 nativeMain {
3435 dependencies {
3536 api(libs.crt.kotlin)
37+ implementation(libs.kotlin.multiplatform.bignum)
3638 }
3739 }
3840
@@ -50,17 +52,24 @@ kotlin {
5052 }
5153 }
5254
53- nativeMain {
54- dependencies {
55- implementation(libs.kotlin.multiplatform.bignum)
56- }
57- }
58-
5955 all {
6056 languageSettings.optIn(" aws.smithy.kotlin.runtime.InternalApi" )
6157 }
6258 }
6359
60+ if (NATIVE_ENABLED && ! HostManager .hostIsMingw) {
61+ targets.withType<KotlinNativeTarget > {
62+ compilations[" main" ].cinterops {
63+ val interopDir = " $projectDir /posix/src/posixInterop/cinterop"
64+ create(" environ" ) {
65+ includeDirs(interopDir)
66+ packageName(" aws.smithy.platform.posix" )
67+ headers(listOf (" $interopDir /environ.h" ))
68+ }
69+ }
70+ }
71+ }
72+
6473 if (NATIVE_ENABLED && HostManager .hostIsMingw) {
6574 mingwX64 {
6675 val mingwHome = findMingwHome()
Original file line number Diff line number Diff line change 1+ #ifndef ENVIRON_H
2+ #define ENVIRON_H
3+
4+ // External declaration to get environment variables
5+ extern char * * environ ;
6+
7+ // Helper function to get the environ pointer
8+ char * * get_environ_ptr () {
9+ return environ ;
10+ }
11+
12+ #endif
You can’t perform that action at this time.
0 commit comments