diff --git a/tests/mtouch/MTouch.cs b/tests/mtouch/MTouch.cs index b91b15078090..05c2a56202f6 100644 --- a/tests/mtouch/MTouch.cs +++ b/tests/mtouch/MTouch.cs @@ -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 = "") { diff --git a/tools/common/Assembly.cs b/tools/common/Assembly.cs index 1cc10d2fc5d2..715adaa43510 100644 --- a/tools/common/Assembly.cs +++ b/tools/common/Assembly.cs @@ -334,16 +334,16 @@ public void ComputeLinkerFlags () case "libsystem_kernel": break; case "sqlite3": - if (LinkWith == null) - LinkWith = new List (); - LinkWith.Add ("-lsqlite3"); + if (LinkerFlags == null) + LinkerFlags = new List (); + 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 (); - LinkWith.Add ("-l" + file.Substring (3)); + if (LinkerFlags == null) + LinkerFlags = new List (); + 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":