Problem with dlopen()

2009-11-01 Thread Juan Jose Garcia-Ripoll
This function does some nonstandard things, but the most annoying one
is imposing that the library to be loaded has to have a file
extension.

If I invoke dlopen(/path/to/temp/dir/temporary_file, ...) then the
routine fails with an error like File or directory does not exist.
It is probably not that text, but something similar output by
dlerror(). If I rename the file as temporary_file.foo then dlopen()
succeeds.

Using strace reveals that in the first case dlopen() is adding the
extension .dll and complaining that the file does not exist. In
addition to this, the file has to be given executable permissions
using chmod() or dlopen will fail.

The reason I found this bug is that ECL (Embeddable Common Lisp)
compiles lisp files to DLLs and uses nonstandard names for that. With
mingw32 and Microsoft Visual Studio C++ we never had a problem, but
cygwin broke when we used our code.

Juanjo

-- 
Instituto de FĂ­sica Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com

--
Problem reports:   http://cygwin.com/problems.html
FAQ:   http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple



Lost characters with fputc/putc

2007-12-26 Thread Juan Jose Garcia-Ripoll
Hi,

I am the maintainer of a free common lisp environment called ECL
(http://ecls.sourceforge.net), which has been ported to cygwin long
time ago.

Recently I have noticed some problems with a code that basically does this
 - open a FILE with w+b
 - write a character to it
 - flush
 - close file
The thing is that if I use fputc or putc to write the character, it is
lost, while using fwrite() does just the right thing. I just show you
the difference
#if 1
if (fputc(c, fp) == EOF) /* version A */
io_error(strm);
#else
if (fwrite(c, 1, 1, fp)  1) /* version B */
io_error(strm);
#endif

No other file operation is performed on this file and I have not been
able to simplify this to a smaller C program that shows this problem
so far, but I am just comparing two big programs which only differ on
these two lines. The same program just builds and runs fine on Linux,
FreeBSD, OpenBSD, NetBSD, Mac OS X and Solaris, as well as with Mingw
and MSVC, so I suspect there is something wrong with the cygwin port
or the cygwin libraries exclusively.

Help on solving this issue is most welcome. Otherwise I will simply
have to abandon this port.

Cheers,

Juanjo

P.S.: In case somebody wants to reproduce this, after building ECL
with ./configure --prefix=$HOME or something similar, and installing
it, just do ecl.exe -load file.lsp where file.lsp contains the
following lines.

(si::system rm -f foo) ; delete previous files
(LET ((S (OPEN foo :direction :IO :if-does-not-exist :create)))
   (write-char #\h s) ; create a file foo with only a character
   (force-output s)
   (close s))
(si::system cat foo; echo) ; type file to see whether character is present
(si::system ls -l foo*)

-- 
Facultad de Fisicas, Universidad Complutense,
Ciudad Universitaria s/n Madrid 28040 (Spain)
http://juanjose.garciaripoll.googlepages.com

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/