public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Nested functions with GCC in OS X
@ 2007-03-21 18:44 Blake Huff
  0 siblings, 0 replies; only message in thread
From: Blake Huff @ 2007-03-21 18:44 UTC (permalink / raw)
  To: GCC-Help

Hi All:

Hopefully this is the right list for this question. Does anyone have  
any experience building nested functions into dynamically linked  
library files (.so) on Mac OS X 10.4.9, with gcc 4.0.1.   I am  
confused on several points by this.  Here's an example of the problem  
with the associated errors:

gcc -dynamiclib calc_mean.c -o libmean.so -fnested-functions
/usr/bin/libtool: unknown option character `l' in: -allow_stack_execute
Usage: /usr/bin/libtool -static [-] file [...] [-filelist listfile 
[,dirname]] [-arch_only arch] [-sacLT]
Usage: /usr/bin/libtool -dynamic [-] file [...] [-filelist listfile 
[,dirname]] [-arch_only arch] [-o output] [-install_name name] [- 
compatibility_version #] [-current_version #] [-seg1addr 0x#] [- 
segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table  
<filename>] [-seg_addr_table_filename <file_system_path>] [-all_load]  
[-noall_load]

Obviously libtool doesn't know what -allow_stack_execute is because - 
allow_stack_execute is an option for ld, not libtool.  Any ideas how  
to get the right flag from the compiler to ld?

In another project with nested functions, the '-fnested-functions' is  
never specified during the compile process, yet at runtime the  
program fails with an error message:

  /usr/bin/ld: -allow_stack_execute can only be used when output file  
type is MH_EXECUTE
collect2: ld returned 1 exit status


This is unusual, because neither '-fnested-functions' nor '- 
allow_stack_execute' were specified.  I'm assuming that ld is sensing  
the need for an executable stack, and producing an error because  
their isn't one. This error seems to indicate to me that you cannot  
have nested functions inside a dynamically linked library, as such a  
library will never have the type of MH_EXECUTE.

Does anyone have any experience with nested functions, ideas about  
what's going on?
Thanks in advance for any suggestions.


"Hats and mittens you kittens!"

Blake Huff
stangmechanic@gmail.com





^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-03-21 18:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-21 18:44 Nested functions with GCC in OS X Blake Huff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).