Delivered-To: listarch-cygwin AT sourceware DOT cygnus DOT com Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm Sender: cygwin-owner AT sourceware DOT cygnus DOT com Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com Content-return: allowed Date: Fri, 12 Feb 1999 12:05:13 -0800 From: "Vasudevan, Gopal" Subject: RE: Help on mexing with Mingw32 and g77! To: cygwin AT sourceware DOT cygnus DOT com, "'Paul Sokoilovsky'" Message-id: <7B07215DF838D211A4440000F81F0665161E21@emss01m09.ems.lmco.com> MIME-version: 1.0 X-Mailer: Internet Mail Service (5.5.2232.9) Content-type: text/plain Hi, Thank you for your comments. I do have a work around for being unable to mex with g77. It is to write the so called mex Gateway function using C. But I did include a file called dllinit.c, which was taken from Mumit Khan's example in dllhelpers-0.2.1/f77. I however, added the following lines to it. /* Copied from winsup/dcrt0.cc in the cygwin32 source distribution. */ asm(".section .idata\$3\n" ".long 0,0,0,0, 0,0,0,0"); /* Next one is needed to properly terminate the .reloc section in the dll */ asm(".section .reloc\n" ".long 0,8"); I am not sure exactly why these are needed, but the dll's that I have created seem to work only with this in it. Also added --driver-name g77 as a flag for the dllwrap. If you or anyone else is interested, please contact me, and I shall send a Makefile and the sample sources. Now just because it worked for me is no guarantee that it will work for you, (perhaps because of the Phase-of-the-moon bug). Additionally, Thanks to all out there for making/developing EGCS for MS-Windows XX systems. Regards Gopal > ---------- > From: Paul Sokolovsky[SMTP:paul-ml AT is DOT lg DOT ua] > Reply To: Paul Sokoilovsky > Sent: Wednesday, February 10, 1999 10:55 AM > To: cygwin AT sourceware DOT cygnus DOT com; Vasudevan, Gopal > Subject: Re: Help on mexing with Mingw32 and g77! > > Hello Vasudevan,, > > Vasudevan, Gopal wrote: > > VG>With some amount of struggling I did manage to > VG> compile and create a .dll file only to have Matlab 5.2 complain: > VG> ??? DLL load failed for mex file , error is A device > attached > VG> to the system is not functioning. > > VG> Here is my procedure to create the aforementioned .dll file. I am > using > VG> the example files fprime.f and fprimeG.f. > VG> I have been successful in mexing the equivalent .c function to a > working > VG> .dll. Any ideas? I have looked through almost every web site that > talked > VG> about even remotely about mex. > > You say that you was succesful with C, so... But there's something > I spend nice time with: all mingw32 distributions up to egcs 1.1 > produce broken nonrelocatable dll's (more precisely, there > workability fase-of-moon dependent: I saw relocatable dlls produced, I > saw dlls which don't load at all). I haven't tried egcs 1.1.1 yet, but > I don't think problem's gone: bug is in the bfd, probably in its like > to use past-eof seeks to align sections (ms leaves previous data > there, though that region supposed to be zeroed). Cygnus reported > workaround for this in b20, and since cygwin linker produces correct > dlls, but cygwin strip still f%#@%$ up them %) So: try to use latest > cygwin ld instead of mingw32's. > > > VG> Thanks > VG> Gopal > > > > Best regards, > Paul mailto:paul-ml AT is DOT lg DOT ua >