<div dir="ltr"><div>You made a small typo: <br></div><div><br></div><div><span lang="EN-US">example_dll.cpp, example_dll.dll, example_dll.h, example_dll.o, example_exe.cpp,
<b>libexample_dll.a</b></span></div><div><span lang="EN-US"><b><br></b></span></div><div><span lang="EN-US">And in your code, you call it example_dll.a instead of libexample_dll.a: <br></span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><span lang="EN-US"><br></span></div><div>  extra-libraries:<br>    - example_dll.a</div></blockquote><div><br></div><div>That should probably be:<br><br><blockquote>  extra-libraries:<br>    - libexample_dll.a</blockquote></div><div><span lang="EN-US"></span></div><div><span lang="EN-US"><b></b></span></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Feb 26, 2019 at 7:48 AM S. H. Aegis <<a href="mailto:shaegis@gmail.com">shaegis@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">



















<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US">Hello.<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US">I’m new to stack & FFI.<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span class="gmail-m_-5474547907520950415gmail-tlid-translation"><span lang="EN-US">I created a
dll file by <a href="http://www.mingw.org/wiki/sampleDLL" style="color:rgb(5,99,193);text-decoration:underline" target="_blank">http://www.mingw.org/wiki/sampleDLL</a><span></span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US">And I put all files into dll folder. (Those
files are example_dll.cpp, example_dll.dll, example_dll.h, example_dll.o, example_exe.cpp,
libexample_dll.a) I test example_exe.exe file, and confirmed that works.</span></p><p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"">(Windows7 Pro, stack 1.9.3)<br></p><p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US"><package.yaml><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">executables</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">:<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>  </span></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">test2-exe</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">:<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>   
</span></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">main</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">:<span>                </span></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">Main.hs</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>   
</span></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">source-dirs</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">:<span>        
</span></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">app</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>   
</span></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">ghc-options</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">:<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>   
</span>- </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">-threaded</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>   
</span>- </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">-rtsopts</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>   
</span>- </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">-with-rtsopts=-N</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>   
</span></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">dependencies</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">:<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>   
</span>- </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">test2</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>   
</span></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">extra-libraries</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">:<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>   
</span>- </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">example_dll.a</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>   
</span></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">extra-lib-dirs</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">:<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>   
</span>- </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">dll</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US"><stack.yaml><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(106,153,85)" lang="EN-US"># Extra directories used by stack for
building</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">extra-include-dirs</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">:<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span> 
</span>- </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">dll</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">extra-lib-dirs</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">:<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span> 
</span>- </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">dll</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US"><Main.hs><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">{-# LANGUAGE ForeignFunctionInterface
#-}</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span> </span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">module</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> Main </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">where</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span> </span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(106,153,85)" lang="EN-US">-- import Lib</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">import</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> Foreign<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span> </span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">foreign </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">import</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> ccall "example_dll.h hello"<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>   
</span></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(220,220,170)" lang="EN-US">c_hello</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">::</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">IO</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">()<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span> </span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(220,220,170)" lang="EN-US">main</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">::</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">IO</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> ()<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">main = c_hello<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US"><example_dll.cpp><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(197,134,192)" lang="EN-US">#include</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US"> </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US"><stdio.h></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(197,134,192)" lang="EN-US">#include</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US"> </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">"example_dll.h"</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span> </span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">__stdcall </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">void</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(220,220,170)" lang="EN-US">hello</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">const</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">char</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> *s)<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">{<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>       
</span></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(220,220,170)" lang="EN-US">printf</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">"Hello %s</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(215,186,125)" lang="EN-US">\n</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">"</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">, s);<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">}<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">int</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(220,220,170)" lang="EN-US">Double</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">int</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> x)<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">{<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>       
</span></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(197,134,192)" lang="EN-US">return</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(181,206,168)" lang="EN-US">2</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> * x;<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">}<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">void</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(220,220,170)" lang="EN-US">CppFunc</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">void</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">)<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">{<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>       
</span></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(220,220,170)" lang="EN-US">puts</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">"CppFunc"</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">);<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">}<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">void</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"> </span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(220,220,170)" lang="EN-US">MyClass::func</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(86,156,214)" lang="EN-US">void</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">)<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">{<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US"><span>       
</span></span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(220,220,170)" lang="EN-US">puts</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">(</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(206,145,120)" lang="EN-US">"MyClass.func()"</span><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">);<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 0.0001pt;text-align:left;line-height:14.25pt;background:rgb(30,30,30) none repeat scroll 0% 0%;word-break:keep-all;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515"" align="left"><span style="font-size:10.5pt;font-family:Consolas;color:rgb(212,212,212)" lang="EN-US">}<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US"><span> </span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US">When I try to stack build, I get error
messages.<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US"><span> </span></span></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">C:\Users\shaegis\Documents\Haskell\test2\dll>stack
build<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">Building all executables for `test2' once. After a
successful build of all of them, only specified executables will be rebuilt.<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">test2-0.1.0.0: configure (lib + exe)<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">Configuring test2-0.1.0.0...<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6.3.exe: Missing
dependency on a foreign<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">library:<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">* Missing (or bad) C library: example_dll.a<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">This problem can usually be solved by installing the
system package that<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">provides this library (you may need the
"-dev" version). If the library is<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">already installed but in a non-standard location then
you can use the flags<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">--extra-include-dirs= and --extra-lib-dirs= to specify
where it is.If the<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">library file does exist, it may contain errors that
are caught by the C<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">compiler at the preprocessing stage. In this case you
can re-run configure<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">with the verbosity flag -v3 to see the error messages.<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US"><span> </span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">--<span>  </span>While building
package test2-0.1.0.0 using:<span></span></span></i></p>

<p class="MsoNormal" style="line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US"><span>     
</span>C:\sr\setup-exe-cache\x86_64-windows\Cabal-simple_Z6RU0evB_2.4.0.1_ghc-8.6.3.exe
--builddir=.stack-work\dist\e626a42b configure
--with-ghc=C:\Users\shaegis\AppData\Local\Programs\stack\x86_64-windows\ghc-8.6.3\bin\ghc.EXE
--with-ghc-pkg=C:\Users\shaegis\AppData\Local\Programs\stack\x86_64-windows\ghc-8.6.3\bin\ghc-pkg.EXE
--user --package-db=clear --package-db=global
--package-db=C:\sr\snapshots\3233b5e2\pkgdb
--package-db=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\pkgdb
--libdir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\lib
--bindir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\bin
--datadir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\share
--libexecdir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\libexec
--sysconfdir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\etc
--docdir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\doc\test2-0.1.0.0
--htmldir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\doc\test2-0.1.0.0
--haddockdir=C:\Users\shaegis\Documents\Haskell\test2\.stack-work\install\784ab3f0\doc\test2-0.1.0.0
--dependency=base=base-4.12.0.0
--extra-include-dirs=C:\Users\shaegis\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\include
--extra-include-dirs=C:\Users\shaegis\Documents\Haskell\test2\dll
--extra-lib-dirs=C:\Users\shaegis\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\bin
--extra-lib-dirs=C:\Users\shaegis\AppData\Local\Programs\stack\x86_64-windows\msys2-20180531\mingw64\lib
--extra-lib-dirs=C:\Users\shaegis\Documents\Haskell\test2\dll --enable-tests
--enable-benchmarks<span></span></span></i></p>

<p class="MsoNormal" style="text-indent:20.25pt;line-height:normal;margin:0cm 0cm 8pt;text-align:justify;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><i><span lang="EN-US">Process exited with code:
ExitFailure 1<span></span></span></i></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US"><span> </span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US">How can I fix this? I did a lot of things
on the webpages, but I could not.<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US">Please, help me.<span></span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US"><span> </span></span></p>

<p class="MsoNormal" style="margin:0cm 0cm 8pt;text-align:justify;line-height:107%;font-size:10pt;font-family:"\00b9d1\00c740  \00ace0\00b515""><span lang="EN-US">Sincerely, S. Chang.<span></span></span></p>





</div>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>