libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mingw-users] Whats the latest on libtool and the stub dll libraries


From: Elizabeth Barham
Subject: Re: [Mingw-users] Whats the latest on libtool and the stub dll libraries?
Date: 26 Sep 2002 16:01:07 -0500

Earnie Boyd <address@hidden> 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,address@hidden -o \$output_objdir/\$soname \$libobjs \$deplibs 
\$compiler_flags~
        \$DLLTOOL --as=\$AS --dllname \$soname --exclude-symbols 
address@hidden,address@hidden,address@hidden,address@hidden,address@hidden 
--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,address@hidden -o \$output_objdir/\$soname 
\$libobjs \$deplibs \$compiler_flags~
        \$DLLTOOL --as=\$AS --dllname \$soname --exclude-symbols 
address@hidden,address@hidden,address@hidden,address@hidden,address@hidden 
--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,address@hidden -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








reply via email to

[Prev in Thread] Current Thread [Next in Thread]