runtime icon indicating copy to clipboard operation
runtime copied to clipboard

.Net Core 2.0 DllImport not working in Linux

Open ms0713 opened this issue 8 years ago • 1 comments

Steps to reproduce

@martinwoodward What is the alternative for following code: This code i m using in Windows. I want alternate code for Linux(RHEL7).

usingSystem.Runtime.InteropServices;
namespace PInvokeSamples {
    public static class Program {
        // Import the kernel32.dll and define the method corresponding to the native function.
        [DllImport("kernel32.dll")]
        private static extern uint GetCurrentThreadId();

        public static void Main(string[] args){
            // Invoke the function and get the process Thread ID.
            uint tid = GetCurrentThreadId();
            Console.WriteLine(tid);
        }
    }
}

Expected behavior

It should work on Linux(RHEL7)

Actual behavior

It is not working in Linux(RHEL7)

Environment data

It is working fine on windows machine.

ms0713 avatar Jan 04 '18 07:01 ms0713

Moved to coreclr

steveharter avatar Jan 04 '18 20:01 steveharter