Earnie Boyd <[EMAIL PROTECTED]> writes:

> > On a related note, I have been having to add a "main" function to the
> > DLL's like so:
> > 
> > #if defined(__MINGW32__) && defined(DLL_EXPORT)
> > int
> > main(int argc, char* argv[])
> > {
> >   return 0;
> > }
> > #endif
> > 
> 
> You shouldn't do this.  I posted on the libtool list a
> mingwlibsample.tar.gz under the heading of "Simple dll and static
> library creation for MinGW" dated 9/19/2002.

<http://www.soggytrousers.net/repository/mingwlibsample.tar.gz>

> > If I do not add this, it does not build the DLL. I'm concerned about
> > the export of this function, however - if more than one DLL uses this
> > method, could there be some kind of conflict and/or is there a better
> > way to deal with this?
> > 
> 
> The -shared switch is required to build the dll.

If anyone is interested in this, libtool made the dll fine without the
main function mentioned above by adding -shared after the $CC:

--BEGIN--
# Commands used to build and install a shared archive.
archive_cmds=""
archive_expsym_cmds="if test \\\"x\\\`sed 1q \$export_symbols\\\`\\\" = xEXPORTS; then
          cp \$export_symbols \$output_objdir/\$soname-def;
        else
          echo EXPORTS > \$output_objdir/\$soname-def;
          _lt_hint=1;
          cat \$export_symbols | while read symbol; do
           set dummy \\\$symbol;
           case \\\$# in
             2) echo \\\"   \\\$2 @ \\\$_lt_hint ; \\\" >> 
\$output_objdir/\$soname-def;;
             4) echo \\\"   \\\$2 \\\$3 \\\$4 ; \\\" >> \$output_objdir/\$soname-def; 
_lt_hint=\\\`expr \\\$_lt_hint - 1\\\`;;
             *) echo \\\"   \\\$2 @ \\\$_lt_hint \\\$3 ; \\\" >> 
\$output_objdir/\$soname-def;;
           esac;
           _lt_hint=\\\`expr 1 + \\\$_lt_hint\\\`;
          done;
        fi~
        
        \$CC -shared -Wl,--base-file,\$output_objdir/\$soname-base  
-Wl,-e,_DllMainCRTStartup@12 -o \$output_objdir/\$soname \$libobjs \$deplibs 
\$compiler_flags~
        \$DLLTOOL --as=\$AS --dllname \$soname --exclude-symbols 
DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
 --def \$output_objdir/\$soname-def --base-file \$output_objdir/\$soname-base 
--output-exp \$output_objdir/\$soname-exp~
        \$CC  -shared -Wl,--base-file,\$output_objdir/\$soname-base 
\$output_objdir/\$soname-exp  -Wl,-e,_DllMainCRTStartup@12 -o \$output_objdir/\$soname 
\$libobjs \$deplibs \$compiler_flags~
        \$DLLTOOL --as=\$AS --dllname \$soname --exclude-symbols 
DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12,DllMainCRTStartup@12,DllEntryPoint@12
 --def \$output_objdir/\$soname-def --base-file \$output_objdir/\$soname-base 
--output-exp \$output_objdir/\$soname-exp --output-lib \$output_objdir/\$libname.dll.a~
        \$CC -shared \$output_objdir/\$soname-exp  -Wl,-e,_DllMainCRTStartup@12 -o 
\$output_objdir/\$soname \$libobjs \$deplibs \$compiler_flags"
postinstall_cmds=""
postuninstall_cmds=""
--END--

Note the addition of "-shared" after the \$CC. Similar lines may be
found in libtool.m4 v. 1.264 at 4700, 4702 and 4704.

Elizabeth






_______________________________________________
Libtool mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/libtool

Reply via email to