Skip to content

Commit

Permalink
RID-specific lib...
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Feb 16, 2017
1 parent d90ebb6 commit 96062c9
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ public class NativeCode
{
public static string InvokeNativeCodeAndReturnAString()
{
return Marshal.PtrToStringAnsi(NativeMethod.sqlite3_libversion());
switch(GetRidStoredInAssemblyDescriptionAttribute())
{
case "ubuntu.14.04-x64":
return Marshal.PtrToStringAnsi(NativeMethod.sqlite3_libversion());
case "osx.10.11-x64":
return Marshal.PtrToStringAnsi(NativeMethod.sqlite3_dylibversion());
case "win10-x64":
return Marshal.PtrToStringAnsi(NativeMethod.sqlite3_dllversion());
default:
return "Unexpected RID. Cannot find sqlite3.";
}
}

public static string GetRidStoredInAssemblyDescriptionAttribute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ public static class NativeMethod
{
[DllImport("libsqlite3", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr sqlite3_libversion();

[DllImport("libsqlite3", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr sqlite3_dylibversion();

[DllImport("sqlite3", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr sqlite3_dllversion();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,17 @@ public class NativeCode
{
public static string InvokeNativeCodeAndReturnAString()
{
return Marshal.PtrToStringAnsi(NativeMethod.sqlite3_libversion());
switch(GetRidStoredInAssemblyDescriptionAttribute())
{
case "ubuntu.14.04-x64":
return Marshal.PtrToStringAnsi(NativeMethod.sqlite3_libversion());
case "osx.10.11-x64":
return Marshal.PtrToStringAnsi(NativeMethod.sqlite3_dylibversion());
case "win10-x64":
return Marshal.PtrToStringAnsi(NativeMethod.sqlite3_dllversion());
default:
return "Unexpected RID. Cannot find sqlite3.";
}
}

public static string GetRidStoredInAssemblyDescriptionAttribute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ public static class NativeMethod
{
[DllImport("libsqlite3", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr sqlite3_libversion();

[DllImport("libsqlite3", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr sqlite3_dylibversion();

[DllImport("sqlite3", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr sqlite3_dllversion();
}
}

0 comments on commit 96062c9

Please sign in to comment.