<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Approximatrix Forums — Bug in the Makefile creation for DLL]]></title>
		<link>https://forums.approximatrix.com/viewtopic.php?id=257</link>
		<atom:link href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=257&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Bug in the Makefile creation for DLL.]]></description>
		<lastBuildDate>Tue, 15 Oct 2013 18:46:11 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1027#p1027</link>
			<description><![CDATA[<p>I just saw the new version this evening.</p><p>Many thanks.</p>]]></description>
			<author><![CDATA[null@example.com (ecanot)]]></author>
			<pubDate>Tue, 15 Oct 2013 18:46:11 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1027#p1027</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1026#p1026</link>
			<description><![CDATA[<p>Édouard,</p><p>Version 2.4 is now available, and it allows enabling/disabling static linking in Project Options.&nbsp; It will continue to provide static linking by default, but it can be easily disabled now.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Tue, 15 Oct 2013 13:06:13 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1026#p1026</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1017#p1017</link>
			<description><![CDATA[<p>Édouard,</p><p>That&#039;s great to hear!&nbsp; I&#039;ll look into possibly making the desktop icon optional (since it doesn&#039;t work properly on my Debian GNU/Linux desktop either), and, of course, 2.4 will allow optionally switching off the static linking.</p><p>-Jeff</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Thu, 03 Oct 2013 20:36:46 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1017#p1017</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1016#p1016</link>
			<description><![CDATA[<p>Jeff, for your information, I just tried this evening SF-2.3 with wine-1.7.1:<br /></p><ul><li><p>as before, SF cannot be launch by clicking on the desktop icon; but clicking on any project file launches it.</p></li><li><p>once built, the program can be executed inside the IDE (contrary to wine-1.4.1) by typing F5. Input values may be entered in the bottom bar, after clicking to the send button.</p></li><li><p>the debugger seems to work properly, at least for a small test program of 20 lines. Stepping between lines works. Input/Output are done in a separated window.</p></li></ul><p>Regards,<br />Édouard</p>]]></description>
			<author><![CDATA[null@example.com (ecanot)]]></author>
			<pubDate>Thu, 03 Oct 2013 20:27:51 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1016#p1016</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1015#p1015</link>
			<description><![CDATA[<p>I appreciate your input here concerning the static linking.&nbsp; I plan on adding an option in the next version to enable/disable the static flag.&nbsp; You are correct that having multiple DLLs all including their own copies of the GNU Fortran runtime is not particularly efficient.&nbsp; In cases where you&#039;re linking maybe one DLL, it is useful, especially if you&#039;re linking to a Simply-Fortran-created DLL from another language, Visual Basic for example.&nbsp; If you&#039;re building multiple DLLs with Simply Fortran and then linking everything to a Simply-Fortran-created executable, the static linking is entirely unnecessary.</p><p>The next version will include an option to disable the static linking option on a per-project basis.</p><p>I&#039;ll also make sure all launch options work properly under GNU/Linux and WINE.&nbsp; WINE tends to deal with handles to consoles a bit differently than true Windows, so that might be what you&#039;re experiencing.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Thu, 03 Oct 2013 15:21:19 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1015#p1015</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1014#p1014</link>
			<description><![CDATA[<p>Sorry, when typing my comment at 17:05, I didn&#039;t see yours at 15:04 ...</p>]]></description>
			<author><![CDATA[null@example.com (ecanot)]]></author>
			<pubDate>Thu, 03 Oct 2013 15:08:21 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1014#p1014</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1013#p1013</link>
			<description><![CDATA[<p>Size of files is important when creating a number of executables to test a library. In my case (<a href="http://people.irisa.fr/Edouard.Canot/muesli">MUESLI library</a>), when using static libraries under linux, each executable may have its size up to 20 Mb, even if the main program file is very small. So the use of shared libraries is required and unavoidable to build small executables.</p><p>Let&#039;s consider the two following ways (taking again my previous example of libone+libtwo+executable):<br /></p><ol class="decimal"><li><p>the removing of the <strong>-static</strong> flag in the Makefile, before building the executable</p></li><li><p>the use of an <strong>import library</strong> for each DLL</p></li></ol><p>Sizes obtained are the following ones:<br /></p><ol class="decimal"><li><p>libone.dll=56.5 kB, libtwo.dll=59.7 kB, exe=66.4 kB</p></li><li><p>libone.dll=64.1 kB, libtwo.dll=346.7 kB, exe=73.8 kB</p></li></ol><p>For libtwo, it looks like the presence of the <strong>-static</strong> flag has forced to include many symbols (libgfortran ?, ...). Ok, the two executables have a similar size but, in my case, I prefer use the first method (even it is annoying to modify the Makefile each time) because I am working with a long chain of dependant libraries (arpack, blas, lapack, suitesparse, libz, fml).</p><p>Anyway, thank you for all your detailed explainations.<br />Perhaps the addition of a new option disabling the <strong>-static</strong> flag is a good idea...</p><p>Considering the use of SF under linux, I&#039;m using the wine package provided for ubuntu-13.04: it is wine-1.4.1, released on march 2012 if I&#039;m not wrong. Latest stable version of wine is 1.6, released on july 2013, but I don&#039;t use it.<br />All things work, even the splash screen, but I must launch SF (the fwin.exe executable actually) by clicking on any project file, not on the SF icon installed on the desktop. I never tried to use the debugger in the 2.2 version. But an annoying thing is that the executable cannot be launched inside the IDE. I have to open a terminal, cd to the folder containing the executable and typing &quot;./my_prog.exe&quot;, then the program is automatically run via wine. In the case where DLL are used, they must be all copied (or soft linked under linux) in the same location.</p>]]></description>
			<author><![CDATA[null@example.com (ecanot)]]></author>
			<pubDate>Thu, 03 Oct 2013 15:05:30 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1013#p1013</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1012#p1012</link>
			<description><![CDATA[<p>True, I hadn&#039;t considered the default behavior on GNU/Linux, and I suppose on Windows, it will simply replace the <em>.so</em> extension with <em>.dll</em>.&nbsp; That said, the general &quot;preferred&quot; route under Windows is to use import libraries when dealing with linking to DLLs.&nbsp; As I pointed out, the GTK+ libraries do so, and I know from experience that Python uses the same technique under Windows.</p><p>I&#039;ve had complaints about the size of executables and libraries created by Simply Fortran before, and, of course, it is due to statically linking the GNU Fortran runtime library to the targets.&nbsp; However, the size is not anything close to problematic on today&#039;s modern hard disks, and it eliminates two possible issues.&nbsp; First, it gets rid of the need to further contaminate the system path with the compiler&#039;s internal library directory.&nbsp; Second, it allows programs built with Simply Fortran to be shared with others without having to hunt down the GNU Fortran and GCC runtime DLLs.</p><p>The tradeoff is a few hundred kilobytes of disk space for a little more ease of use and fewer headaches.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Thu, 03 Oct 2013 13:04:40 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1012#p1012</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1011#p1011</link>
			<description><![CDATA[<p>&quot;Apparently, if you remove the -static flag, it will instead use libone.dll if anything, which is actually a bit of a surprise to me.&quot; ?<br />Not so surprising... under linux, the standard mechanism of loading libraries, when specifying &#039;-lone&#039; is first to find a libone.so file<br />(shared library) and then to find a libone.a file (static library).</p><p>I&#039;ll add some comment later on, about the size of the executable.</p>]]></description>
			<author><![CDATA[null@example.com (ecanot)]]></author>
			<pubDate>Thu, 03 Oct 2013 12:43:33 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1011#p1011</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1009#p1009</link>
			<description><![CDATA[<p>Okay, I see why you&#039;re having the issue.&nbsp; Your library flag in the libtwo project is:</p><p><strong>-lone</strong></p><p>The compiler, with the <strong>-static</strong> flag set, is looking for a file named <strong>libone.a</strong>.&nbsp; Apparently, if you remove the <strong>-static</strong> flag, it will instead use <strong>libone.dll</strong> if anything, which is actually a bit of a surprise to me.</p><p>Anyway, the ideal solution is to generate an import library while building the DLL.&nbsp; Simply Fortran probably should do this by default, but it currently doesn&#039;t.&nbsp; We ideally want to create a file <strong>libone.dll.a</strong> that will merely contain the declaration of exported symbols in <strong>libone.dll</strong>.&nbsp; To do so, load your libone project and open the <em>Project Options</em> dialog.&nbsp; In the Linker text field under Project Flags, add the following:</p><p><strong>-Wl,--out-implib=libone.dll.a</strong></p><p>That first part is &quot;capital double-U el,&quot; and it instructs gfortran to pass along the flag after the comma to the linker directly.&nbsp; Now clean and rebuild your libone project.&nbsp; If you navigate to that directory, you should now see a <strong>libone.dll</strong> and <strong>libone.dll.a</strong>.</p><p>Next, open your libtwo project.&nbsp; Open the <em>Project Options</em> dialog and change your library flag from:</p><p><strong>-lone</strong></p><p>to:</p><p><strong>-lone.dll</strong></p><p>Clean and rebuild your project, and everything should work fine.</p><p>The above method is actually how most GNU-compiled DLLs are linked to under Windows.&nbsp; The GTK+ project is a good example.&nbsp; In their lib directory are an assortment of &quot;libgtk-2.0.dll.a&quot; and similar files.</p><p>The above should fix your issue, although it is not necessarily ideal.&nbsp; I think Simply Fortran should allow for two things:</p><p>1. Import libraries should be created by default when building DLLs</p><p>2. Users should be able to optionally disable static linking</p><p>Let me know if this solution works out.&nbsp; &nbsp; It&#039;s good to hear someone is using Simply Fortran under WINE.&nbsp; A reasonable amount of Simply Fortran&#039;s development takes place under WINE using Simply Fortran itself as the IDE.&nbsp; The only real issue I&#039;ve come across is the Start screen not loading properly.&nbsp; If you do see any other problems under WINE, please don&#039;t hesitate to post them.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Thu, 03 Oct 2013 12:18:43 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1009#p1009</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1008#p1008</link>
			<description><![CDATA[<p>I forgot to say that I&#039;m testing SF-2.2 under linux via the wine loader, not directly under windows.</p><p>Usually, I&#039;m developping under linux with all the GNU tools and with my own Makefiles.</p>]]></description>
			<author><![CDATA[null@example.com (ecanot)]]></author>
			<pubDate>Thu, 03 Oct 2013 11:29:41 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1008#p1008</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1007#p1007</link>
			<description><![CDATA[<p>Consider a simple example of two DLLs : libone and libtwo. Files are stored in separated folders and each one<br />has a project file.</p><p>The first DLL is of course successfully created:<br />&quot;C:\Program Files (x86)\Simply Fortran 2\mingw-w64\bin\gfortran.exe&quot; -c -o &quot;build\libone.o&quot; -m32 -Jmodules &quot;libone.f90&quot;<br />&quot;C:\Program Files (x86)\Simply Fortran 2\mingw-w64\bin\gfortran.exe&quot; -o &quot;libone.dll&quot; -shared -static -m32 &quot;build\libone.o&quot; -LC:/PROG~5P2/SIMP~CHN/MING~DAW/lib/</p><p>The second files libtwo.f90 depends on libone.f90 (via modules and subroutine calls), so in the project properties :<br />&nbsp; &nbsp; &nbsp;&quot;..\libone\modules&quot; has been added to the &quot;Include/Module Directories&quot;<br />and<br />&nbsp; &nbsp; &nbsp;&quot;..\libone&quot; has been added to the &quot;Librairies Directories&quot;</p><p>Then, hereafter is the creation of libtwo.dll:<br />&quot;C:\Program Files (x86)\Simply Fortran 2\mingw-w64\bin\gfortran.exe&quot; -c -o &quot;build\libtwo.o&quot; -m32 -IZ:/home/ecanot/tmp/workspace/SimplyFortran/essais/dynamic/libtwo/../libone/modules&nbsp; -Jmodules &quot;libtwo.f90&quot;<br />&quot;C:\Program Files (x86)\Simply Fortran 2\mingw-w64\bin\gfortran.exe&quot; -o &quot;libtwo.dll&quot; -shared -static -m32 &quot;build\libtwo.o&quot; -LC:/PROG~5P2/SIMP~CHN/MING~DAW/lib/ -LZ:/home/ecanot/tmp/workspace/SimplyFortran/essais/dynamic/libtwo/../libone -lone<br />c:/program files (x86)/simply fortran 2/mingw-w64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lone<br />collect2.exe: error: ld returned 1 exit status<br />Error(E42): Last command making (libtwo.dll) returned a bad status<br />Error(E02): Make execution terminated</p><p>Besides, if I remove the &#039;-static&#039; flag from the libtwo Makefile:<br />&quot;C:\Program Files (x86)\Simply Fortran 2\mingw-w64\bin\gfortran.exe&quot; -o &quot;libtwo.dll&quot; -shared -m32 &quot;build\libtwo.o&quot; -LC:/PROG~5P2/SIMP~CHN/MING~DAW/lib/ -LZ:/home/ecanot/tmp/workspace/SimplyFortran/essais/dynamic/libtwo/../libone -lone</p><p>* Complete *</p>]]></description>
			<author><![CDATA[null@example.com (ecanot)]]></author>
			<pubDate>Thu, 03 Oct 2013 10:15:15 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1007#p1007</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1005#p1005</link>
			<description><![CDATA[<p>Could you post the errors listing which libraries cannot be found when building the DLL? </p><p>The <strong>-static</strong> flag was added on purpose alongside the <strong>-shared</strong> flag to force statically linking the GNU Fortran runtime library into the DLL.&nbsp; It was added to fix bugs other users were experiencing.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Thu, 03 Oct 2013 01:15:09 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1005#p1005</guid>
		</item>
		<item>
			<title><![CDATA[Re: Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1004#p1004</link>
			<description><![CDATA[<p>Same thing as above to build the executable when linking with DLLs.<br />I must remove the &#039;-static&#039; flag in order to get a successful link.</p>]]></description>
			<author><![CDATA[null@example.com (ecanot)]]></author>
			<pubDate>Wed, 02 Oct 2013 17:03:59 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1004#p1004</guid>
		</item>
		<item>
			<title><![CDATA[Bug in the Makefile creation for DLL]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1003#p1003</link>
			<description><![CDATA[<p>I want to build a shared library (DLL) using SF-2.2, so in the project options, the &quot;shared library&quot; is checked.<br />But I got some errors (library not found) to link some object files in order to build a shared library (DLL),<br />depending on other DLLs. I&#039;m sure that the PATH for the library is set and that the others DLLs are in the true location.</p><p>Inspecting the Makefile created, I observed that the link step, at the bottom of the Makefile, contains both<br />the &#039;-shared&#039; and &#039;-static&#039; flags.<br />Removing the &#039;-static&#039; flag by hand fix the problem and all the other DLLs are found and then the shared library<br />is created.</p><p>This new bug has been found in the 2.2 (not in the 1.45, as far as I think).</p>]]></description>
			<author><![CDATA[null@example.com (ecanot)]]></author>
			<pubDate>Wed, 02 Oct 2013 15:09:46 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1003#p1003</guid>
		</item>
	</channel>
</rss>
