Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > 71d40963b505df4524269198e237b3e3 > files > 864

virtuoso-opensource-doc-6.1.4-2.fc14.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
 <head profile="http://internetalchemy.org/2003/02/profile">
  <link rel="foaf" type="application/rdf+xml" title="FOAF" href="http://www.openlinksw.com/dataspace/uda/about.rdf" />
  <link rel="schema.dc" href="http://purl.org/dc/elements/1.1/" />
  <meta name="dc.title" content="16. Runtime Hosting" />
  <meta name="dc.subject" content="16. Runtime Hosting" />
  <meta name="dc.creator" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="dc.copyright" content="OpenLink Software, 1999 - 2009" />
  <link rel="top" href="index.html" title="OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="search" href="/doc/adv_search.vspx" title="Search OpenLink Virtuoso Universal Server: Documentation" />
  <link rel="parent" href="runtimehosting.html" title="Chapter Contents" />
  <link rel="prev" href="rthclr.html" title="CLR, .Net &amp; ASPX Host" />
  <link rel="next" href="javaextvm.html" title="Embedded Java VM API" />
  <link rel="shortcut icon" href="../images/misc/favicon.ico" type="image/x-icon" />
  <link rel="stylesheet" type="text/css" href="doc.css" />
  <link rel="stylesheet" type="text/css" href="/doc/translation.css" />
  <title>16. Runtime Hosting</title>
  <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
  <meta name="author" content="OpenLink Software Documentation Team ;&#10;" />
  <meta name="copyright" content="OpenLink Software, 1999 - 2009" />
  <meta name="keywords" content="" />
  <meta name="GENERATOR" content="OpenLink XSLT Team" />
 </head>
 <body>
  <div id="header">
    <a name="rthclrmono" />
    <img src="../images/misc/logo.jpg" alt="" />
    <h1>16. Runtime Hosting</h1>
  </div>
  <div id="navbartop">
   <div>
      <a class="link" href="runtimehosting.html">Chapter Contents</a> | <a class="link" href="rthclr.html" title="CLR, .Net &amp; ASPX Host">Prev</a> | <a class="link" href="javaextvm.html" title="Embedded Java VM API">Next</a>
   </div>
  </div>
  <div id="currenttoc">
   <form method="post" action="/doc/adv_search.vspx">
    <div class="search">Keyword Search: <br />
        <input type="text" name="q" /> <input type="submit" name="go" value="Go" />
    </div>
   </form>
   <div>
      <a href="http://www.openlinksw.com/">www.openlinksw.com</a>
   </div>
   <div>
      <a href="http://docs.openlinksw.com/">docs.openlinksw.com</a>
   </div>
    <br />
   <div>
      <a href="index.html">Book Home</a>
   </div>
    <br />
   <div>
      <a href="contents.html">Contents</a>
   </div>
   <div>
      <a href="preface.html">Preface</a>
   </div>
    <br />
   <div class="selected">
      <a href="runtimehosting.html">Runtime Hosting</a>
   </div>
    <br />
   <div>
      <a href="rthactivation.html">Runtime Environments</a>
   </div>
   <div>
      <a href="rthclr.html">CLR, .Net &amp; ASPX Host</a>
   </div>
   <div class="selected">
      <a href="rthclrmono.html">CLR &amp; Mono</a>
    <div>
        <a href="#rthclrenvsetmono" title="Environment Setup">Environment Setup</a>
        <a href="#rthclrmonotest" title="Testing the Virtuoso Mono Runtime Environment">Testing the Virtuoso Mono Runtime Environment</a>
    </div>
   </div>
   <div>
      <a href="javaextvm.html">Embedded Java VM API</a>
   </div>
   <div>
      <a href="cinterface.html">Virtuoso Server Extension Interface (VSEI) (C Interface)</a>
   </div>
   <div>
      <a href="vseplugins.html">VSEI Plugins</a>
   </div>
    <br />
  </div>
  <div id="text">
    <a name="rthclrmono" />
    <h2>16.3. CLR &amp; Mono</h2>

 <p>The Mono Project is an open development initiative sponsored by Ximian
 that is working to develop an open source, Unix version of the Microsoft .NET
 development and run time platform.  Its objective is to enable Unix developers to build
 and deploy cross-platform .NET Applications.  Likewise, this expands the
 capabilities of Windows programmers, this project opens .NET to non
 Windows platforms.  Mono will implement various Microsoft technologies that
 have now been submitted to the ECMA for standardization.</p>

 <p>The Goal is similar to that of Java, implementing a common virtual machine
 on multiple operating systems, however you are not restricted to one
 language.</p>

 <p>Like .NET, Mono contains a Common Language Infrastructure (CLI) virtual,
 machine that contains a class loader, Just-in-time compiler, and a garbage
 collecting runtime; a class library that can work with any language which
 works on the CLR; a compiler for the C# language.</p>

 <p>Windows has compilers that target the virtual machine from a number
 of languages: Managed C++, JavaScript, Eiffel, Component Pascal, APL, Cobol,
 Perl, Python, Ruby, Scheme, Smalltalk, Standard ML, Haskell, Mercury and Oberon.
 A single object system, threading system, class libraries, and garbage
 collection system can be shared across all these languages, the CLR.</p>

 <p>The CLR and the Common Type System (CTS) enables applications and
 libraries to be written in a collection of different languages that target
 the CLR byte code.  This means that you could define a class to do algebraic
 manipulation written in C#, that class can be reused from any other
 language that supports the CLI.  You could create a class in C#, subclass
 it in C++ and instantiate it in an Eiffel program.</p>

  <div class="tip">
      <div class="tiptitle">See Also:</div>
    <p>The <a href="createassembly.html">Create Assembly</a> Syntax</p>
    <p>The External Hosted <a href="createassembly.html">Create PROCEDURE</a> Syntax</p>
    </div>

 <a name="rthclrenvsetmono" />
    <h3>16.3.1. Environment Setup</h3>
 <p>Ximian announced the launch of the Mono project, an effort to create
 an open source implementation of the .NET Development Framework.</p>
 <p>Follow the steps below to configure the CLR runtime environment
 with Virtuoso:</p>

 <ol>
      <li>
        <div class="formalpara">
          <strong>Install Mono</strong>
  <p>The Mono package is available from the
  <a href="http://www.go-mono.com/">Mono project home page</a> in the
  form of an RPM for Linux.  The source is also available.</p>
  </div>
  </li>
      <li>
        <div class="formalpara">
          <strong>Make mscorlib.dll available to /usr/local/lib</strong>
  <p>The mscorlib.dll is installed by Mono and needs to be symlinked from
  its default location to <span class="computeroutput">/usr/local/lib</span>.</p>
  </div>
  </li>
    </ol>

<br />

 <a name="rthclrmonotest" />
    <h3>16.3.2. Testing the Virtuoso Mono Runtime Environment</h3>
 <p>To test that you have successfully started the Virtuoso server with
 Mono CLR runtime support make a simple library, import the contained class
 into Virtuoso and call it.</p>

 <p>Using an text editor create a C# source file in the server
 root directory called sanity.cs, with the following contents:</p>

 <div>
      <pre class="programlisting">
using System;

public class sanity
{
    public static string test(string  name) {
       return &quot;Hello &quot;+ name + &quot;, from Virtuoso&quot;;
    }
}
</pre>
    </div>
 <p>This sample needs to be compiled into bytecode assembly before it can
 be used.  Make sure you environment is configured to use Mono,
 change directory to the Virtuoso server root containing the C# source file.  Run:</p>

 <div>
      <pre class="programlisting">
bash$ mcs /target:library sanity.cs
Compilation succeeded
</pre>
    </div>

 <p>Now this library must be introduce to the Virtuoso Server.  Using ISQL
 use the following commands to test the CLR:</p>

 <div>
      <pre class="programlisting">
C:\Program Files\OpenLink\Virtuoso 3.0\bin&gt;isql 1112
Connected to OpenLink Virtuoso
Driver: 03.00.2315 OpenLink Virtuoso ODBC Driver
OpenLink Interactive SQL (Virtuoso), version 0.9849b.
Type HELP; for help and EXIT; to exit.
SQL&gt; DB..import_clr (vector (&#39;sanity&#39;), vector (&#39;sanity&#39;));

Done. -- 300 msec.
SQL&gt; select sanity::test(&#39;Rob&#39;);
callret
VARCHAR
______________________________________________

Hello Rob, from Virtuoso

1 Rows. -- 60 msec.
</pre>
    </div>

 <p>Congratulations, you have proven that your Virtuoso server
 can run .NET classes via Mono Runtime.</p>

 <div class="tip">
      <div class="tiptitle">See Also:</div>
 <p>The Virtuoso Tutorials, which are installed with the Demo Virtuoso
 Server (port 1112), contains numerous samples further demonstrating the use
 of the CLR, .NET, Mono and Virtuoso.</p>
    </div>

  <div class="tip">
      <div class="tiptitle">See Also:</div>
    <p>The <a href="createassembly.html">Create Assembly</a> Syntax</p>
    <p>The External Hosted <a href="createassembly.html">Create PROCEDURE</a> Syntax</p>
    </div>

 <br />
<table border="0" width="90%" id="navbarbottom">
    <tr>
        <td align="left" width="33%">
          <a href="rthclr.html" title="CLR, .Net &amp; ASPX Host">Previous</a>
          <br />CLR, .Net &amp; ASPX Host</td>
     <td align="center" width="34%">
          <a href="runtimehosting.html">Chapter Contents</a>
     </td>
        <td align="right" width="33%">
          <a href="javaextvm.html" title="Embedded Java VM API">Next</a>
          <br />Embedded Java VM API</td>
    </tr>
    </table>
  </div>
  <div id="footer">
    <div>Copyright© 1999 - 2009 OpenLink Software All rights reserved.</div>
   <div id="validation">
    <a href="http://validator.w3.org/check/referer">
        <img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" />
    </a>
    <a href="http://jigsaw.w3.org/css-validator/">
        <img src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!" height="31" width="88" />
    </a>
   </div>
  </div>
 </body>
</html>