<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">Hello,</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">I'm currently testing Mono's interoperability between C# and C code, and have run into an interesting scenario.
<span style="mso-spacerun: yes">&nbsp; </span></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">&nbsp;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">In my test case I have a C shared object that implements two functions: setString and getString.
<span style="mso-spacerun: yes">&nbsp; </span>The first function, setString, simply copies the string into a local buffer.<span style="mso-spacerun: yes">&nbsp; </span>The second function, getString, returns a pointer to the internal buffer holding the string.
</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">&nbsp;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">What's interesting is that the first case (in the below C# code) fails when it tries to compare "hello" against the return value of getString.
<span style="mso-spacerun: yes">&nbsp; </span>Is this a problem with trying to compare a unicode string with an ansi string?&nbsp; This test case passes when running under Windows via CLR...fails in Linux via Mono.</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">&nbsp;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">The second case, "hello" == s, passes.</span>
</p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">&nbsp;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">namespace</span><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">
 MonoEvaluation.Interop</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">{</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">
public</span> <span style="COLOR: blue">class</span> <span style="COLOR: #2b91af">Tester</span> : <span style="COLOR: #2b91af">ITester</span></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>{</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>[<span style="COLOR: #2b91af">
DllImport</span>(<span style="COLOR: #a31515">&quot;InteropServerDllC&quot;</span>)]</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">
static</span> <span style="COLOR: blue">extern</span> <span style="COLOR: blue">void</span> setString(<span style="COLOR: blue">string</span> s);</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">&nbsp;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>[<span style="COLOR: #2b91af">
DllImport</span>(<span style="COLOR: #a31515">&quot;InteropServerDllC&quot;</span>)]</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">
static</span> <span style="COLOR: blue">extern</span> <span style="COLOR: blue">string</span> getString();</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">&nbsp;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">
bool</span> StringTest()</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{</span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>setString(
<span style="COLOR: #a31515">&quot;hello&quot;</span>);</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">
string</span> s = getString();</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">&nbsp;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">
if</span> (<span style="COLOR: #a31515">&quot;hello&quot;</span> == getString())</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{</span>
</p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: #2b91af">
Console</span>.WriteLine(<span style="COLOR: #a31515">&quot;hello == getString passed!&quot;</span>);</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</span>
</p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">
else</span></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">{</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 1in; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp; </span>
</span><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;</span><span style="COLOR: #2b91af">Console</span>.WriteLine(<span style="COLOR: #a31515">&quot;hello == getString failed!&quot;
</span>);</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 1in; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>
return false</span><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 1in; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">}</span><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">
</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">&nbsp;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">
if</span> ((<span style="COLOR: #a31515">&quot;hello&quot;</span> <span style="mso-spacerun: yes">&nbsp;</span>== s)</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{</span>
</p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: #2b91af">
Console</span>.WriteLine(<span style="COLOR: #a31515">&quot;hello == s passed!&quot;</span>);</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</span>
</p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="COLOR: blue">
else</span></span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: 0.5in; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">{</span><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">
 </span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 1in; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span><span style="COLOR: #2b91af">
Console</span>.WriteLine(<span style="COLOR: #a31515">&quot;hello == s failed!&quot;</span>);</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 1in; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>
return false</span><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 1in; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: #2b91af; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">}</span><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">
</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt 1in; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">return true;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</span></p>

<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">&nbsp;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes"><span style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </span>}</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">}</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">&nbsp;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">I'm running this on an embedded PPC Arabella Linux system, using mono version 
<a href="http://1.2.5.1">1.2.5.1</a>.</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">&nbsp;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">Thanks in Advance,</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">Dan</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: none"><span style="FONT-SIZE: 10pt; FONT-FAMILY: &#39;Courier New&#39;; mso-no-proof: yes">&nbsp;</span></p>
<p class="MsoNormal" style="MARGIN: 0in 0in 0pt"><span style="FONT-SIZE: 10pt; FONT-FAMILY: Arial">&nbsp;</span></p>