Author: gert
Date: 2008-02-10 04:38:41 -0500 (Sun, 10 Feb 2008)
New Revision: 95361
Added:
trunk/gert/standalone/bug360375/
trunk/gert/standalone/bug360375/default.build
trunk/gert/standalone/bug360375/test.c
trunk/gert/standalone/bug360375/test.cs
trunk/gert/standalone/bug360375/testcase.c
trunk/gert/standalone/bug360375/testcase.def
trunk/gert/standalone/bug360375/testcase.h
Modified:
trunk/gert/standalone/known-issues
Log:
Added test for bug #360375.
Added: trunk/gert/standalone/bug360375/default.build
===================================================================
--- trunk/gert/standalone/bug360375/default.build 2008-02-10 08:36:04 UTC
(rev 95360)
+++ trunk/gert/standalone/bug360375/default.build 2008-02-10 09:38:41 UTC
(rev 95361)
@@ -0,0 +1,74 @@
+<project name="bug360157" default="rebuild">
+ <include buildfile="../../build/common.build" />
+
+ <property name="frameworks" value="mono-1.0,mono-2.0,net-1.1,net-2.0" />
+
+ <target name="clean">
+ <delete>
+ <fileset>
+ <include name="out" />
+ <include name="test.exe" />
+ <include name="libtestcase.so" />
+ <include name="testcase.dll" />
+ <include name="testcase.exp" />
+ <include name="testcase.lib" />
+ <include name="testcase.o" />
+ <include name="testcase.obj" />
+ </fileset>
+ </delete>
+ </target>
+
+ <target name="compile" depends="init">
+ <choose>
+ <when test="${platform::is-unix()}">
+ <exec program="gcc">
+ <arg value="-c" />
+ <arg value="-fPIC" />
+ <arg file="testcase.c" />
+ <arg value="-o" />
+ <arg file="testcase.o" />
+ </exec>
+
+ <exec program="gcc">
+ <arg value="-shared" />
+ <arg value="-o" />
+ <arg value="libtestcase.so" />
+ <arg file="testcase.o" />
+ </exec>
+ </when>
+ <otherwise>
+ <cl outputdir=".">
+ <defines>
+ <define name="_WINDLL" />
+ <define name="_MBCS" />
+ </defines>
+ <sources>
+ <include name="testcase.c" />
+ </sources>
+ </cl>
+ <link output="testcase.dll"
moduledefinition="testcase.def">
+ <sources>
+ <include name="testcase.obj" />
+ </sources>
+ <arg value="/DLL" />
+ <arg value="/MACHINE:X86" />
+ </link>
+ </otherwise>
+ </choose>
+
+ <csc target="exe" define="${csc.defines}" output="test.exe"
warnaserror="true" warninglevel="4">
+ <sources>
+ <include name="../../build/common/Assert.cs" />
+ <include name="test.cs" />
+ </sources>
+ <references>
+ <include name="System.Data.dll" />
+ </references>
+ </csc>
+ </target>
+
+ <target name="run-test" depends="compile">
+ <exec program="test.exe" managed="true" output="out" />
+ <fail if="${file::exists('out')}" />
+ </target>
+</project>
Property changes on: trunk/gert/standalone/bug360375/default.build
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/gert/standalone/bug360375/test.c
===================================================================
--- trunk/gert/standalone/bug360375/test.c 2008-02-10 08:36:04 UTC (rev
95360)
+++ trunk/gert/standalone/bug360375/test.c 2008-02-10 09:38:41 UTC (rev
95361)
@@ -0,0 +1,8 @@
+#include "testcase.h"
+
+int main(int argc, const char* argv[])
+{
+ struct test_struct ts;
+ test(&ts);
+ printf("%d\n", ts.b.b);
+}
Added: trunk/gert/standalone/bug360375/test.cs
===================================================================
--- trunk/gert/standalone/bug360375/test.cs 2008-02-10 08:36:04 UTC (rev
95360)
+++ trunk/gert/standalone/bug360375/test.cs 2008-02-10 09:38:41 UTC (rev
95361)
@@ -0,0 +1,31 @@
+using System;
+using System.Runtime.InteropServices;
+
+class Program
+{
+ [DllImport ("testcase")]
+ static extern void test (ref test_struct ts);
+
+ [StructLayout (LayoutKind.Explicit)]
+ struct test_union
+ {
+ [FieldOffset (0)]
+ public byte a;
+ [FieldOffset (0)]
+ public int b;
+ }
+
+ [StructLayout (LayoutKind.Sequential)]
+ struct test_struct
+ {
+ public byte a;
+ public test_union b;
+ }
+
+ static int Main ()
+ {
+ test_struct ts = new test_struct ();
+ test (ref ts);
+ return (ts.b.b == 42) ? 0 : 1;
+ }
+}
Property changes on: trunk/gert/standalone/bug360375/test.cs
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/gert/standalone/bug360375/testcase.c
===================================================================
--- trunk/gert/standalone/bug360375/testcase.c 2008-02-10 08:36:04 UTC (rev
95360)
+++ trunk/gert/standalone/bug360375/testcase.c 2008-02-10 09:38:41 UTC (rev
95361)
@@ -0,0 +1,7 @@
+#include "testcase.h"
+
+void test(struct test_struct *ts)
+{
+ int a = 42;
+ ts->b.b = a;
+}
Added: trunk/gert/standalone/bug360375/testcase.def
===================================================================
--- trunk/gert/standalone/bug360375/testcase.def 2008-02-10 08:36:04 UTC
(rev 95360)
+++ trunk/gert/standalone/bug360375/testcase.def 2008-02-10 09:38:41 UTC
(rev 95361)
@@ -0,0 +1,4 @@
+LIBRARY "testcase"
+
+EXPORTS
+ test
Added: trunk/gert/standalone/bug360375/testcase.h
===================================================================
--- trunk/gert/standalone/bug360375/testcase.h 2008-02-10 08:36:04 UTC (rev
95360)
+++ trunk/gert/standalone/bug360375/testcase.h 2008-02-10 09:38:41 UTC (rev
95361)
@@ -0,0 +1,11 @@
+union test_union {
+ unsigned char a;
+ int b;
+};
+
+struct test_struct {
+ unsigned char a;
+ union test_union b;
+};
+
+extern void test(struct test_struct *ts);
Modified: trunk/gert/standalone/known-issues
===================================================================
--- trunk/gert/standalone/known-issues 2008-02-10 08:36:04 UTC (rev 95360)
+++ trunk/gert/standalone/known-issues 2008-02-10 09:38:41 UTC (rev 95361)
@@ -142,3 +142,4 @@
bug358987/**
bug359783/**
bug360157/**
+bug360375/**
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches