creating shared dlls yields undefined reference to `WinMain@16' in mingw 4.3

"Daniel Walter" <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
Whenever I add an object file that was generated with gcj to a g++ link 
command for a shared dll, I get an undefined reference to `WinMain@16'. 
This seems to indicate that for some reason gcc wants to build an executable 
instead of a shared library.  This was working in gcc 3.4 - though I was 
using cygwin with gcj -mno-cygwin which is no longer supported.

Is building dlls with g++ and gcj supported in newer versions of gcc?
Is there a different link command that will not try to build an executable?


works> g++ -shared cpptest.o -o pdflib.dll

works - event with lgcj> g++ -shared cpptest.o -lgcj -lws2_32 -o pdflib.dll

fails - it tries to build an executable> g++ -shared javatest.o 
cpptest.o -lgcj -lws2_32 -o pdflib.dll

Daniel

BTW, thank you for the help with the C++ references for garabage collection. 
Exactly how this works is still a little fuzzy, but at least I know what I 
can do to make things work.


gcc -v
Using built-in specs.
Reading specs from c:/documents and settings/dan/my 
documents/programs/cygwin/ho
me/dan/ming/bin/../lib/gcc/mingw32/4.3.0/libgcj.spec
rename spec startfile to startfileorig
rename spec lib to liborig
Target: mingw32
Configured with: 
./gcc-4.3.0/configure --enable-languages=c,ada,c++,fortran,jav
a,objc,obj-c++ --disable-sjlj-exceptions --enable-shared --enable-libgcj --enabl
e-libgomp --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --enab
le-concept-checks --enable-version-specific-runtime-libs --build=mingw32 --with-
bugurl=http://www.mingw.org/bugs.shtml --prefix=/mingw --with-gmp=/mingw/src/gcc
/gmp-mpfr-root --with-mpfr=/mingw/src/gcc/gmp-mpfr-root --with-libiconv-prefix=/
mingw/src/gcc/libiconv-root
Thread model: win32
gcc version 4.3.0 20080305 (alpha-testing) mingw-20080502 (GCC)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.