示例#1
0
        public static IntPtr AllocHGlobal(int cb)
        {
            // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201505/20150503/udp
            var p = new CMalloc(cb);

            return((IntPtr)p);
        }
示例#2
0
        // https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/201505/20150503/udp

        // X:\jsc.svn\examples\java\hybrid\JVMCLRLoadLibrary\JVMCLRLoadLibrary\Program.cs

        public static IntPtr StringToHGlobalAnsi(string s)
        {
            if (s == null)
            {
                return((IntPtr)CPtr.NULL);
            }

            var bytes = (sbyte[])(object)Encoding.ASCII.GetBytes(s);
            var p     = new CMalloc(bytes.Length + 1);

            p.copyIn(0, bytes, 0, bytes.Length);

            return((IntPtr)p);
        }
示例#3
0
        public static IntPtr AllocHGlobal(int cb)
        {
            var p = new CMalloc(cb);

            return((IntPtr)p);
        }