Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > bd5c3d824c3db63ffd9226c15941e6ad > files > 2237

mozart-1.4.0-1mdv2010.0.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>6 The Oz DLL Builder: oztool</TITLE><LINK href="ozdoc.css" rel="stylesheet" type="text/css"></HEAD><BODY><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node13.html#chapter.profiler">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node15.html#chapter.convert">Next &gt;&gt;</A></TD></TR></TABLE><DIV id="chapter.oztool"><H1><A name="chapter.oztool">6 The Oz DLL Builder: <CODE>oztool</CODE></A></H1><P><CODE>oztool</CODE> facilitates the creation of native functors (see <A href="../apptut/node19.html#part.foreign.extensions">Part&nbsp;VI of ``Application Programming''</A> and <A href="../foreign/index.html">``Interfacing to C and C++''</A>). A native functor is a DLL, i.&nbsp;e. a library that is dynamically loaded by the Oz emulator and interfaces with it. Creating a native functor often involves complicated compilation and linking technicalities (e.&nbsp;g. options). <CODE>oztool</CODE> takes care of these details for you. </P><DL><DT><CODE>oztool&nbsp;c++&nbsp;...</CODE></DT><DD><P>Instead of calling the C++ compiler directly, you should invoke it through <CODE>oztool</CODE>. The advantages are: it calls the right compiler, with the right options, and also extends the include search path to find the Mozart specific includes such as <CODE>mozart.h</CODE>. Normally, you would compile a native functor implemented in <CODE>foo.cc</CODE> using: </P><BLOCKQUOTE class="code"><CODE>oztool&nbsp;c++&nbsp;-c&nbsp;foo.cc</CODE></BLOCKQUOTE><P> </P></DD><DT><CODE>oztool&nbsp;cc&nbsp;...</CODE></DT><DD><P>Same idea, but for the C compiler </P></DD><DT><CODE>oztool&nbsp;ld&nbsp;...</CODE></DT><DD><P>Instead of calling the linker directly, you should also invoke it through <CODE>oztool</CODE>. Again, the advantages are that it calls the right linker, with the right options. Normally, you would create a DLL from <CODE>foo.o</CODE> as follows: </P><BLOCKQUOTE class="code"><CODE>oztool&nbsp;ld&nbsp;-o&nbsp;foo.so&nbsp;foo.o</CODE></BLOCKQUOTE><P> </P></DD><DT><CODE>oztool&nbsp;platform</CODE></DT><DD><P>The default <A href="../system/node50.html#chapter.resolve">Resolution</A> mechanism locates architecture specific DLLs as follows: If the system needs a native functor called (abstractly) <CODE>foo.so</CODE>, then it will look for a DLL called <CODE>foo.so-linux-i486</CODE> on a Linux machine, <CODE>foo.so-solaris-sparc</CODE> on a Solaris machine, or <CODE>foo.so-win32</CODE> on a Windows machine, etc... Thus, when you create a DLL, you should install it with a name where the machine's architecture is appended. Invoking <CODE>oztool&nbsp;platform</CODE> simply prints out the appropriate architecture name for your machine. In this respect, <CODE>oztool</CODE> helps you write portable Makefiles: to create a DLL from file <CODE>foo.cc</CODE> you would normally invoke: </P><BLOCKQUOTE class="code"><CODE>oztool&nbsp;c++&nbsp;-c&nbsp;foo.cc<BR>oztool&nbsp;ld&nbsp;-o&nbsp;foo.so-`oztool&nbsp;platform`&nbsp;foo.o</CODE></BLOCKQUOTE><P></P></DD></DL><P></P><DIV id="section.oztool-env"><H2><A name="section.oztool-env">6.1 Windows Environment Variables</A></H2><P>Under Windows, <CODE>oztool</CODE> supports the use of several compilers as described in <A href="../foreign/node5.html#chapter.windll">Chapter&nbsp;5 of ``Interfacing to C and C++''</A>. Furthermore, when using the GNU compiler suite, the exact name of the compilers and linker to invoke can be set by the environment variables shown in the following table with their default values. </P><TABLE align="center" class="dyptic"><TR valign="top"><TH><P>Environment Variable</P></TH><TH><P>Default Value</P></TH></TR><TR valign="top"><TD><P><A name="label13"></A><A name="label14"></A><CODE>OZTOOL_CC</CODE></P></TD><TD><P><CODE>gcc&nbsp;-mno-cygwin</CODE></P></TD></TR><TR valign="top"><TD><P><A name="label15"></A><A name="label16"></A><CODE>OZTOOL_CXX</CODE></P></TD><TD><P><CODE>g++&nbsp;-mno-cygwin</CODE></P></TD></TR><TR valign="top"><TD><P><A name="label17"></A><A name="label18"></A><CODE>OZTOOL_LD</CODE></P></TD><TD><P><CODE>g++&nbsp;-mno-cygwin</CODE></P></TD></TR></TABLE><P> </P><P>These values correspond to the compilers used to build Mozart. The above binaries are provided by the Cygwin <CODE>gcc</CODE> package. Note that using a different compiler can lead to problems, as described in <A href="../foreign/node5.html#section.compilerproblems">Section&nbsp;5.1 of ``Interfacing to C and C++''</A>.</P></DIV></DIV><TABLE align="center" border="0" cellpadding="6" cellspacing="6" class="nav"><TR bgcolor="#DDDDDD"><TD><A href="node13.html#chapter.profiler">&lt;&lt; Prev</A></TD><TD><A href="index.html">- Up -</A></TD><TD><A href="node15.html#chapter.convert">Next &gt;&gt;</A></TD></TR></TABLE><HR><ADDRESS><A href="http://www.ps.uni-sb.de/~duchier/">Denys&nbsp;Duchier</A>, <A href="http://www.ps.uni-sb.de/~kornstae/">Leif&nbsp;Kornstaedt</A> and&nbsp;<A href="http://www.ps.uni-sb.de/~schulte/">Christian&nbsp;Schulte</A><BR><SPAN class="version">Version 1.4.0 (20090610)</SPAN></ADDRESS></BODY></HTML>