This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

RE: Help on mexing with Mingw32 and g77!



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@is.lg.ua]
> Reply To: 	Paul Sokoilovsky
> Sent: 	Wednesday, February 10, 1999 10:55 AM
> To: 	cygwin@sourceware.cygnus.com; Vasudevan, Gopal
> Subject: 	Re: Help on mexing with Mingw32 and g77!
> 
> Hello Vasudevan,,
> 
> Vasudevan, Gopal <gopal.vasudevan@lmco.com> 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@is.lg.ua
>