-
Notifications
You must be signed in to change notification settings - Fork 11
/
NativeFunctions.cs
32 lines (29 loc) · 1.28 KB
/
NativeFunctions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
* Copyright (C)
* Arnaud Champion <[email protected]>
* Jaromír Červenka <[email protected]>
*
* See COPYING.LIB for the License of this software
*/
using System;
using System.Runtime.InteropServices;
namespace Libvirt
{
/// <summary>
/// The class expose some useful native functions
/// </summary>
public class NativeFunctions
{
// TODO : this is a temporary workaround for virConnectOpenAuth callback, this should be removed
/// <summary>
/// duplicate a string. The strdup function shall return a pointer to a new string, which is a duplicate of the string pointed to by s1.
/// </summary>
/// <param name="strSource">Pointer to the string that should be duplicated</param>
/// <returns>a pointer to a new string on success. Otherwise, it shall return a null pointer</returns>
[DllImport("msvcrt.dll", EntryPoint = "_strdup", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr StrDup(IntPtr strSource);
// TODO : this is a temporary workaround for virConnectOpenAuth callback, this should be removed
[DllImport("msvcrt.dll", EntryPoint = "free", CallingConvention = CallingConvention.Cdecl)]
public static extern void Free(IntPtr ptr);
}
}