Re: bsd static lib question
Re: bsd static lib question
- Subject: Re: bsd static lib question
- From: Luc Vandal <email@hidden>
- Date: Thu, 10 Feb 2005 21:54:48 -0500
Hi
I did some research in Finder and in the .epx files it found, I always see and underscore before the name of the function:
_NewSampleUSBMIDIDriver
while the declaration looks like this:
extern "C" void *NewSampleUSBMIDIDriver(CFAllocatorRef allocator, CFUUIDRef typeID);
is the underscore important? What about the extern "C"?
Thanks!
On 10-Feb-05, at 7:31 PM, Chris Espinosa wrote:
On Feb 10, 2005, at 3:28 PM, Luc Vandal wrote:
is there anything to do in particular to export functions from a bsd static library? If so, could anyone tell me what to do?
All symbols not declared 'static' will be exported by default. There's nothing you need to do.
If you want to restrict what's exported, there are two techniques.
The first technique is to declare individual symbols as private to the library but external to the current file using the __private_extern__ keyword. This keyword can be used in the same places you would use either the static or extern keywords.
The second technique is to use an export list. This is a file (usually ending in the extension .exp) that contains a list of the symbols to export, one per line (\n terminated). Create this file, then choose the target, choose Get Info, click the Build tab, pull down the column header in the first column to the Linking collection, and find the Exported Symbols File build setting; set that to the name of your .exp file. On the next build, only the symbols in that file will be exported in your built library.
To get a start on building an .exp file, nm -gj <file> | sort | uniq will give you a list of all exports from your library.
Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden