From 3f93eb4b0efc86ccc966dc9db9ab11f07b423645 Mon Sep 17 00:00:00 2001 From: triton Date: Sun, 18 Aug 2013 19:07:40 +0100 Subject: [PATCH] Added P/Invoke helpers for unmanaged-unmanaged memory copies. --- build/premake4.lua | 3 +++ src/Runtime/Helpers.cs | 15 +++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 src/Runtime/Helpers.cs diff --git a/build/premake4.lua b/build/premake4.lua index 4a431bf3..4706824f 100644 --- a/build/premake4.lua +++ b/build/premake4.lua @@ -27,6 +27,9 @@ solution "CppSharp" configuration "vs2012" framework "4.0" + configuration "windows" + defines { "WINDOWS" } + configuration {} group "Examples" diff --git a/src/Runtime/Helpers.cs b/src/Runtime/Helpers.cs new file mode 100644 index 00000000..f0563bb8 --- /dev/null +++ b/src/Runtime/Helpers.cs @@ -0,0 +1,15 @@ +using System; +using System.Runtime.InteropServices; + +namespace CppSharp.Runtime +{ + public static class Helpers + { +#if WINDOWS + [DllImport("msvcrt.dll", EntryPoint = "memcpy", CallingConvention = CallingConvention.Cdecl)] +#else + [DllImport("libc", EntryPoint = "memcpy")] +#endif + public static extern IntPtr memcpy(IntPtr dest, IntPtr src, UIntPtr count); + } +}