github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/runtime/env_windows.go (about)

     1  //go:build windows
     2  
     3  package runtime
     4  
     5  // Set environment variable in Windows:
     6  //
     7  //	BOOL SetEnvironmentVariableA(
     8  //	    [in]           LPCSTR lpName,
     9  //	    [in, optional] LPCSTR lpValue
    10  //	);
    11  //
    12  //export SetEnvironmentVariableA
    13  func _SetEnvironmentVariableA(key, val *byte) bool
    14  
    15  func setenv(key, val *byte) {
    16  	// ignore any errors
    17  	_SetEnvironmentVariableA(key, val)
    18  }
    19  
    20  func unsetenv(key *byte) {
    21  	// ignore any errors
    22  	_SetEnvironmentVariableA(key, nil)
    23  }