[Top][All Lists]

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

extra exports with libtool (pr-msvc-support)

From: David Byron
Subject: extra exports with libtool (pr-msvc-support)
Date: Mon, 24 Aug 2009 14:53:43 -0700

I'm running into a situation where libtool is exporting something I don't
expect it to.  I've attached a tarball that demonstrates this.  

So it's more clear what I'm talking about without having to dive into the
attachment, I'm compiling a shared library that I think should have one
export.  But it contains a function that would be available from a static
lib but isn't explicitly this:

#include <private.h>
#include <stdio.h>

foo ( const char *bar )
    printf("%s: %s\n",__FUNCTION__,bar);
    return 1;

int     foo ( const char *bar );

#include <private.h>

int public_func ( const char *a_string );

public_func ( const char *a_string )
    return foo(a_string);

My assumption is that foo shouldn't be visible to users of the shared lib.

Here's what I do:

>From a cygwin bash:

$ mkdir raw
$ tar xzvf foo.tar.gz -C raw
$ cd raw
$ cl -I. -c private.c
$ cl -I. -c public.c
$ link /DLL private.obj public.obj /OUT:foo.dll
$ dumpbin /exports foo.dll

Note that that only export is public_func.

To complete building an executable:

$ cl -I. -c main.c
$ link main.obj foo.lib /OUT:test.exe

And now for the libtool part, from an MSYS bash:

$ mkdir lt
$ tar xzvf foo.tar.gz -C lt
$ cd lt
$ autoreconf -fvi
$ mkdir build
$ cd build
$ ../configure CC=cl CFLAGS='-MD -Zi' LD=link NM='dumpbin -symbols' AR=lib
STRIP=: RANLIB=: --disable-static
$ make
$ dumpbin -exports .libs/foo-0.dll

And here, there are two exports, public_func and foo.

Am I correct to expect only public_func as an export?  What can I do to
convince libtool to keep function foo hidden?

Thanks for your help.

automake (GNU automake) 1.11
autoconf (GNU Autoconf) 2.63

And the pr-msvc-support branch of libtool:

libtool (GNU libtool 1.3107 2009-03-20) 2.2.7a


Attachment: foo.tar.gz
Description: Binary data

reply via email to

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