Created
September 25, 2018 20:35
-
-
Save teamday/2e4cfb6c0f99d940d812e1c1d5fd06f1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) Microsoft. All rights reserved. | |
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | |
using System; | |
using System.Runtime.CompilerServices; | |
using System.Runtime.InteropServices; | |
partial class Interop | |
{ | |
const string LIBC = "libc"; | |
[DllImport(LIBC, EntryPoint = "getenv")] | |
private static extern IntPtr getenv_core(string name); | |
internal static string getenv(string name) | |
{ | |
return Marshal.PtrToStringAnsi(getenv_core(name)); | |
} | |
[DllImport(LIBC)] | |
internal static extern unsafe int snprintf(byte* str, IntPtr size, string format, string arg1); | |
[DllImport(LIBC)] | |
internal static extern unsafe int snprintf(byte* str, IntPtr size, string format, int arg1); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment