<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156849</link>
    <title>MATLAB Central Newsreader - mex linux source for windows</title>
    <description>Feed for thread: mex linux source for windows</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Thu, 27 Sep 2007 20:40:29 -0400</pubDate>
      <title>mex linux source for windows</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156849#394287</link>
      <author>Lars Barring</author>
      <description>Dear all,&lt;br&gt;
&lt;br&gt;
We have a some Linux C-library code that has been &lt;br&gt;
successfully mexed for Linux. Now we would like to &lt;br&gt;
transport this this to the Windows environment.&lt;br&gt;
&lt;br&gt;
I have very little experience in this area so all &lt;br&gt;
suggestions would be welcome. I have been searching the &lt;br&gt;
web and found some web pages on mingw, cygwin, and &lt;br&gt;
gnumex. While these seems to be pointing in the right &lt;br&gt;
direction, more direct/specific/hands-on suggestions and &lt;br&gt;
experience would be most welcome. &lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Many thanks,&lt;br&gt;
Lars</description>
    </item>
    <item>
      <pubDate>Fri, 28 Sep 2007 20:29:20 -0400</pubDate>
      <title>Re: mex linux source for windows</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156849#394430</link>
      <author>Ralph Schleicher</author>
      <description>&quot;Lars Barring&quot; &amp;lt;lars.barring@myworkplace.se&amp;gt; writes:&lt;br&gt;
&lt;br&gt;
&amp;gt; We have a some Linux C-library code that has been &lt;br&gt;
&amp;gt; successfully mexed for Linux. Now we would like to &lt;br&gt;
&amp;gt; transport this this to the Windows environment.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; I have very little experience in this area so all &lt;br&gt;
&amp;gt; suggestions would be welcome. I have been searching the &lt;br&gt;
&amp;gt; web and found some web pages on mingw, cygwin, and &lt;br&gt;
&amp;gt; gnumex. While these seems to be pointing in the right &lt;br&gt;
&amp;gt; direction, more direct/specific/hands-on suggestions and &lt;br&gt;
&amp;gt; experience would be most welcome. &lt;br&gt;
&lt;br&gt;
Hi Lars,&lt;br&gt;
&lt;br&gt;
if you want to create Windows MEX files using a Unix style build&lt;br&gt;
environment, you have to setup a cross-compiler (either Linux:MinGW&lt;br&gt;
or Cygwin:MinGW).  Then compilation is as easy as&lt;br&gt;
&lt;br&gt;
# Directory containing a copy of $MATLAB/bin, $MATLAB/extern, and&lt;br&gt;
# $MATLAB/simulink/include from a Matlab Windows installation.&lt;br&gt;
export MATLAB=/opt/w32/matlab-6.1&lt;br&gt;
export MATLAB_ARCH=win32&lt;br&gt;
export MEXEXT=dll&lt;br&gt;
/configure --build=i686-pc-linux-gnu --host=i686-pc-mingw32&lt;br&gt;
&lt;br&gt;
Useful tools can be found at&lt;br&gt;
&lt;br&gt;
&lt;a href=&quot;http://home.allgaeu.org/rschleic/rs/pub/m-config/&quot;&gt;http://home.allgaeu.org/rschleic/rs/pub/m-config/&lt;/a&gt;&lt;br&gt;
&lt;a href=&quot;http://home.allgaeu.org/rschleic/rs/pub/mextool/&quot;&gt;http://home.allgaeu.org/rschleic/rs/pub/mextool/&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Ralph&lt;br&gt;
&lt;br&gt;
5425 days of Linux experience.</description>
    </item>
    <item>
      <pubDate>Fri, 01 Feb 2008 17:20:19 -0500</pubDate>
      <title>Re: mex linux source for windows</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156849#412463</link>
      <author>Chris Van Kleeck</author>
      <description>Ralph Schleicher &amp;lt;rs+usenet@nunatak.allgaeu.org&amp;gt; wrote in&lt;br&gt;
message &amp;lt;87ve9uwn33.fsf@bravo.nunatak.allgaeu.org&amp;gt;...&lt;br&gt;
&amp;gt; &quot;Lars Barring&quot; &amp;lt;lars.barring@myworkplace.se&amp;gt; writes:&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &amp;gt; We have a some Linux C-library code that has been &lt;br&gt;
&amp;gt; &amp;gt; successfully mexed for Linux. Now we would like to &lt;br&gt;
&amp;gt; &amp;gt; transport this this to the Windows environment.&lt;br&gt;
&amp;gt; &amp;gt;&lt;br&gt;
&amp;gt; &amp;gt; I have very little experience in this area so all &lt;br&gt;
&amp;gt; &amp;gt; suggestions would be welcome. I have been searching the &lt;br&gt;
&amp;gt; &amp;gt; web and found some web pages on mingw, cygwin, and &lt;br&gt;
&amp;gt; &amp;gt; gnumex. While these seems to be pointing in the right &lt;br&gt;
&amp;gt; &amp;gt; direction, more direct/specific/hands-on suggestions and &lt;br&gt;
&amp;gt; &amp;gt; experience would be most welcome. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Hi Lars,&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; if you want to create Windows MEX files using a Unix style&lt;br&gt;
build&lt;br&gt;
&amp;gt; environment, you have to setup a cross-compiler (either&lt;br&gt;
Linux:MinGW&lt;br&gt;
&amp;gt; or Cygwin:MinGW).  Then compilation is as easy as&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; # Directory containing a copy of $MATLAB/bin,&lt;br&gt;
$MATLAB/extern, and&lt;br&gt;
&amp;gt; # $MATLAB/simulink/include from a Matlab Windows installation.&lt;br&gt;
&amp;gt; export MATLAB=/opt/w32/matlab-6.1&lt;br&gt;
&amp;gt; export MATLAB_ARCH=win32&lt;br&gt;
&amp;gt; export MEXEXT=dll&lt;br&gt;
&amp;gt; /configure --build=i686-pc-linux-gnu --host=i686-pc-mingw32&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; Useful tools can be found at&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; &lt;a href=&quot;http://home.allgaeu.org/rschleic/rs/pub/m-config/&quot;&gt;http://home.allgaeu.org/rschleic/rs/pub/m-config/&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;a href=&quot;http://home.allgaeu.org/rschleic/rs/pub/mextool/&quot;&gt;http://home.allgaeu.org/rschleic/rs/pub/mextool/&lt;/a&gt;&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; -- &lt;br&gt;
&amp;gt; Ralph&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Ralph,&lt;br&gt;
Do you know if it is possible to use a Linux compiled mex&lt;br&gt;
function as a s-function in Simulink (DOS). Or is there&lt;br&gt;
another cross compiler required to do this?</description>
    </item>
    <item>
      <pubDate>Tue, 07 Dec 2010 11:25:05 -0500</pubDate>
      <title>Re: mex linux source for windows</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156849#802520</link>
      <author>Thomas </author>
      <description>I am running into a similar problem where I've a mexopts.bat written up in gfortran. It used to run in linux. Now, I want to convert the source code to be running in windows xp. Can you please post some hints as to how the cross-compilation is achieved.&lt;br&gt;
Thanks,&lt;br&gt;
Thomas</description>
    </item>
    <item>
      <pubDate>Sat, 11 Dec 2010 13:42:35 -0500</pubDate>
      <title>Re: mex linux source for windows</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/156849#803825</link>
      <author>Ralph Schleicher</author>
      <description>&quot;Thomas &quot; &amp;lt;tclyue@gmail.com&amp;gt; writes:&lt;br&gt;
&lt;br&gt;
Full name?&lt;br&gt;
&lt;br&gt;
&amp;gt; I am running into a similar problem where I've a mexopts.bat written&lt;br&gt;
&amp;gt; up in gfortran. It used to run in linux. Now, I want to convert the&lt;br&gt;
&amp;gt; source code to be running in windows xp. Can you please post some&lt;br&gt;
&amp;gt; hints as to how the cross-compilation is achieved.  Thanks, Thomas&lt;br&gt;
&lt;br&gt;
You have to setup a cross-compilation environment, that is&lt;br&gt;
&lt;br&gt;
&amp;nbsp;* Build and install a MinGW cross-compiler toolchain on your Unix box&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;Binutils: ./configure --host=i686-pc-mingw32 --target=i686-pc-mingw32&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;GCC: ./configure --host=i686-pc-mingw32 --target=i686-pc-mingw32 --enable-languages=c,c++,f77&lt;br&gt;
&lt;br&gt;
&amp;nbsp;* Install mingw-runtime and w32api in /usr/local/i686-pc-mingw32&lt;br&gt;
&lt;br&gt;
&amp;nbsp;* Install Matlab libraries and header files from your Windows box&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;in /usr/local/i686-pc-mingw32, for example&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$ mkdir /usr/local/i686-pc-mingw32/matlab-7.1&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$ cd /usr/local/i686-pc-mingw32/matlab-7.1&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$ (cd &quot;/mnt/Program Files/Matlab-7.1&quot; &amp;&amp; tar -cf- bin extern rtw simulink stateflow) | tar -xf-&lt;br&gt;
&lt;br&gt;
&amp;nbsp;* Adjust mexopts.sh, that is change compilers and tools from 'foo' to&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;'foo-i686-pc-mingw32' and change path names for libraries and header&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;files.  As an alternative, use Libtool to build Matlab MEX-Files.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;Libtool knows all details for cross-compiling loadable modules.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;See also my Mextool script for building MEX-files with Libtool and&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;Automake/Autoconf.&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Ralph Schleicher  &amp;lt;&lt;a href=&quot;http://ralph-schleicher.de&quot;&gt;http://ralph-schleicher.de&lt;/a&gt;&amp;gt;&lt;br&gt;
&lt;br&gt;
Development * Consulting * Training&lt;br&gt;
Mathematical Modeling and Simulation&lt;br&gt;
Software Tools</description>
    </item>
  </channel>
</rss>

