Nicholas Clark wrote:
On Thu, Apr 12, 2007 at 04:56:15PM +0200, [EMAIL PROTECTED] wrote:
On Thu, Apr 12, 2007 at 09:13:14AM -0500, Steve Peters wrote:
On Thu, Apr 12, 2007 at 01:37:24PM +0200, Ron Blaschke wrote:
While poking the GCC documentation I found that there's a feature
available to limit the exported symbols (with GCC >= 3.3). Maybe worth
considering?
It's probably a design decision. If there's an option to limit the
exported symbols or make all available, which one should be taken?
http://gcc.gnu.org/wiki/Visibility
http://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/Function-Attributes.html#Function-Attributes
This can be done by adding C<-fvisibility=hidden> to CFLAGS and setting
PARROT_API to C<__attribute__ ((visibility("default")))>.
I think that we need to tread very carefully with adding additional
gcc-isms to Parrot, lest we break compatibility with additional compilers
even further. If Parrot will run everywhere, we need to think about
working more towards ANSI and POSIX compliance.
I think that the same effect can be achieved using a linker script (although
I don't know much about them), in wich case you are not depending on a
compiler feature.
I thought the same, but I've never seen clear documentation as to how to do it.
Just to elaborate a bit further on what I did: There's a macro called
PARROT_API (see F<include/parrot/config.h>) which is used to tag all
symbols to be exported. On Win32 it expands to C<__declspec(dllexport)>
to export the symbol (see F<config/init/hints/mswin32.pm>), for others
to nothing. For my test I defined it as C<__attribute__ ((visibility
("default")))>.
Ron