[Mono-list] Cygwin woes

Colin JN Breame colin@breame.com
Mon, 13 Dec 2004 06:54:31 +0000


This is a multi-part message in MIME format.
--------------060301050306020809060801
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

This is a multipart-er....

I'm trying to build a cygwin dll which can then be called from the CS 
world.  (please see attachment or end of message for test.c and test.cs)

If I compile with `gcc -shared -mno-cygwin -o test.dll test.c' and `mcs 
test.cs' both test.dll and test.exe is created.  Running test.exe outputs:

start
hello world.
end

as expected.


However, compiled with `gcc -shared -o test.dll test.c', things get weird...

First off, once test.dll has been built, `mcs test.cs' results in a core 
dump.  This is really odd, as if test.dll is deleted, it compiles as it 
should.

Ok, so `mcs test.cs' first then `gcc -shared -o test.dll test.c' and the 
directory contains test.exe and test.dll.  Running test.exe results in a 
core dump (please find attached).

Using the windows .Net runtime, the program terminates prematurely, with 
output:

start

Right,
(a) any ideas what might be going wrong here?  Why is the call to the 
cygwin built dll failing?

(b) why is mcs reading test.dll at all?

I'm using Mono 1.0.4.0 and Cygwin version 1.5.12-1.

Regards
Colin JN Breame


test.c:

#include <stdio.h>

void test() {
        printf("hello world.\n");
        fflush(stdout);
}


test.cs:

using System;
using System.Runtime.InteropServices;

public class Hello {
        [DllImport("test")]
        extern static void test();

        public static void Main(string[] args) {
                Console.WriteLine("start");
                test();
                Console.WriteLine("end");
        }
}


--------------060301050306020809060801
Content-Type: application/x-gzip;
 name="cygwin-test.tar.gz"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename="cygwin-test.tar.gz"

H4sIAOMzvUEAA+2XT2+bMBjGueJPYbELOYRhwOaQapfusErbDuthh7aqKDhgydgRNs2qqd99
hrRZOm3tKiX0kPcnJIP9+g+8PA/YcmPfe4cljrM4p9SVMclpOpbuGMpHPBITmicpyVNXT2JK
mYfpgdc10htbdBh7p1oK9UzcV634FOuZGDvk/6YXsrpeC9vo3l6Xd/VaqMg0+5pjyDbLsn/n
n7Ft/tMkd/E0pZmH430t4DmOPP91WeK5aYqOV3jeKj3fZB/PNR5ejaiScnNSorY0D6fmrVcN
7Is/9L9/8Xv/oX+abPWfMPedIBlLYtD/FDzRP2j+6Bj1v8nwweZ4Sf8kIVv905i5eMJy0P8k
oHdClbKvOD4xthI6aj4gdKtFNco+nOGfyF91QtllGDRcSo3XupNVdKmC2QL5y6XsTRO6ru7P
0VXco7e+IeBV7Oj/YA7/kv5T9nv/lxHXThK3AQT9T0FvhKrx+Z2xvF2g3avoW6+saHl0pizv
9Oqcd7ei5GaBEFr1N1KUuJSFMfjTaAvOJy4+SnnWrnRnw2B4pYLZFfL5D9dbYfeUreux4yxu
HP9hnN3GL4VQzk+c5dQXV7joajN6kH+qldGSR987YflnoXgYDJmzow35j0P+NY6raoy6B3sC
AAAAAAAAAAAAAAAAAAAAjoRf4pdiPAAoAAA=
--------------060301050306020809060801
Content-Type: text/plain;
 name="mono.exe.stackdump"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="mono.exe.stackdump"

Exception: STATUS_ACCESS_VIOLATION at eip=00000000
eax=610F0A10 ebx=00000000 ecx=00000000 edx=01721700 esi=01C5F2F4 edi=00000001
ebp=00000000 esp=01C5F2A8 program=C:\PROGRA~1\MONO-1~1.4\lib\mono.exe, pid 808, thread main
cs=001B ds=0023 es=0023 fs=003B gs=0000 ss=0023
Stack trace:
Frame     Function  Args
End of stack trace

--------------060301050306020809060801--