cygncurses++5.dll [WAS Re: building dlls, C and C++]

Steven O'Brien steven_obrien@lineone.net
Wed Dec 6 05:54:00 GMT 2000


The only outstanding issue from my previous mail on ncurses++ is the need to
invent a main() function in the dll build which was not needed in the static
build.

The c++ sources include a default main() (in c++/cursesmain.cc) which is
linked into the static lib and therefore picked up by a static link, so no
need for the application writer to provide one.

However, when the main() is put into a DLL, the linker can no longer find it
when building an exe - hence the link error about WinMain@16. Modifying
c++/Makefile so that c++/cursesmain.o is ommited fro the dll, but then added
to the import library with ar, means that the shared build now works without
an application main() just like the static build.

As far as I can tell, the runtime behaviour of c++/demo.exe is now identical
whether linked shared or static. I attach a patch which includes all the
mods I made doing these trials. It replaces
CYGWIN-PATCHES/ncurses-5.2-c++-dll.patch. So to build ncurses, using dynamic
linking, from the cygwin sources:

tar zxvf ncurses-5.2-2-src.tar.gz
cd ncurses-5.2
export CFLAGS=-DNCURSES_DLL
export CXXFLAGS=$CFLAGS
 ./configure --enable-symlinks --enable-sigwinch --enable-colorfgbg   \
                    --enable-tcap-names --with-manpage-symlinks --without-de
bug   \
                    --with-normal --disable-termcap --prefix=/usr  \
                    --with-default-terminfo-dir=/usr/share/terminfo   \
                    --enable-echo --with-manpage-symlinks
patch -p1 < CYGWIN-PATCHES/ncurses-5.2-2-dll.patch
patch -p1 < ncurses-5.2-c++-dll-2.patch
make

In the above, replace "ncurses-5.2-c++-dll-2.patch" with the path where you
have placed (and unzipped) the attached patch file.

Steve

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ncurses-5.2-c++-dll-2.patch.gz
Type: application/x-gzip
Size: 2757 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20001206/57347fc1/attachment.bin>


More information about the Cygwin mailing list