Nested functions with GCC in OS X

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

 



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@xxxxxxxxx






[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux