Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions tests/mtouch/MTouch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2172,6 +2172,34 @@ public void MT2015 ()
}
}

[Test]
public void AutoLinkWithSqlite ()
{
using (var mtouch = new MTouchTool ()) {
mtouch.Profile = Profile.iOS;
mtouch.CreateTemporaryApp (code: @"
using System.Runtime.InteropServices;
using Foundation;
using ObjCRuntime;

[assembly: LinkWith (ForceLoad = true)]

[Preserve (AllMembers = true)]
public class TestApp {
[DllImport (""sqlite3"")]
static extern void sqlite3_exec ();

static void Main ()
{
System.Console.WriteLine (typeof (ObjCRuntime.Runtime).ToString ());
}
}
");
mtouch.Linker = MTouchLinker.DontLink; // just to make the test run faster.
mtouch.AssertExecute (MTouchAction.BuildSim, "build");
}
}

#region Helper functions
static string CompileUnifiedTestAppExecutable (string targetDirectory, string code = null, string extraArg = "")
{
Expand Down
12 changes: 6 additions & 6 deletions tools/common/Assembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,16 +334,16 @@ public void ComputeLinkerFlags ()
case "libsystem_kernel":
break;
case "sqlite3":
if (LinkWith == null)
LinkWith = new List<string> ();
LinkWith.Add ("-lsqlite3");
if (LinkerFlags == null)
LinkerFlags = new List<string> ();
LinkerFlags.Add ("-lsqlite3");
Driver.Log (3, "Linking with {0} because it's referenced by a module reference in {1}", file, FileName);
break;
case "libsqlite3":
// remove lib prefix
if (LinkWith == null)
LinkWith = new List<string> ();
LinkWith.Add ("-l" + file.Substring (3));
if (LinkerFlags == null)
LinkerFlags = new List<string> ();
LinkerFlags.Add ("-l" + file.Substring (3));
Driver.Log (3, "Linking with {0} because it's referenced by a module reference in {1}", file, FileName);
break;
case "libGLES":
Expand Down