Re: linking problem
Re: linking problem
- Subject: Re: linking problem
- From: mark <email@hidden>
- Date: Thu, 5 Jul 2007 13:53:04 +1200
- Ironport-content-filter: send-to-smtp
Title: Re: linking problem
On Jul 4, 2007, at 4:32 PM, mark
wrote:
(2) Link your plug-in directly against
the application rather than against a stub library, by specifying the
application as the Bundle Loader in your plug-in's target build
settings. (Keep in mind that you'll need to pass the path to the
actual application executable as the Bundle Loader, not just the path
to the .app wrapper.)
Quick documentation is available directly in the build settings
inspector within Xcode, in Xcode 2.1 or later; you can also check the
ld(1) man page section on its -bundle_loader flag for more
details.
I was hoping I wouldn't have to do that.
It means I have to hard-code the application location into the
plugin.
If the app moves, the plugin will break.
Ah, but that *won't* be the case. Bundle Loader is special; what
it means is "treat this executable as a library at link time, but
try to find any symbols found in it *in whatever loads me* at run
time."
So it doesn't matter if the application moves. The plug-in will
look for imports that originally came from the Bundle Loader at build
time in whatever executable loads it at run time.
How does apple pull it off with it's
10.X.Y SDKs?
When an app loads, globals will link to the running system, not the
SDKs.
The path where a library is located isn't what gets copied into
something that links the library. Rather, it's the "install
path" string that's embedded in the library that gets copied.
So even though a library or framework might be in an SDK directory,
its install path is set as if it were the real system.
-- Chris
Since I removed by stub lib from the plugin project, all my
previously defined application symbols are now undefined as well as
the activeView symbol.
The application export file:
_CopyObjectTypeString
_Pong
_Pong.eh
_activeView
_DTCopyIconRefForFSRef
_DVCopyViewName
_DVGetFSRefPtr
_DVGetViewForWindow
_DV_CopySelectedObjects
_IsADir
_SOCastToSOF
_SOGetFSRef
_activeView
_FSWCreateFSW
_FSWRelease
_GPTAdd
_GetFSWArrayCallbacks
_GetFSWSetCallbacks
Application link command:
Ld
/Users/tridiak/Programming/Directory_Tree/DirTree/build/Development/DirTree.app/Contents/MacOS/DirTree normal i386
cd
/Users/tridiak/Programming/Directory_Tree/DirTree
/usr/bin/g++-4.0 -o
/Users/tridiak/Programming/Directory_Tree/DirTree/build/Development/DirTree.app/Contents/MacOS/DirTree
-L/Users/tridiak/Programming/Directory_Tree/DirTree/build/Development
-F/Users/tridiak/Programming/Directory_Tree/DirTree/build/Development
-filelist
/Users/tridiak/Programming/Directory_Tree/DirTree/build/DirTree.build/Development/Directory\
Tree.build/Objects-normal/i386/DirTree.LinkFileList -framework Carbon
-arch i386 -exported_symbols_list DTExportFile.txt -prebind
-Wl,-Y,1455 -mmacosx-version-min=10.4 -isysroot
/Developer/SDKs/MacOSX10.4u.sdk
nm check on the application's executable shows those symbols
exist.
nm DirTree | grep IsADir gives
0002a786 t _IsADir
000c3f20 s _IsADir.eh
Build command:
Ld
/Users/tridiak/Programming/Directory_Tree/DirTree/DTPlugins/DTBundlePlugin/build/Debug/DTBundlePlugin.bundle/Contents/MacOS/DTBundlePlugin
normal i386
cd
/Users/tridiak/Programming/Directory_Tree/DirTree/DTPlugins/DTBundlePlugin
/usr/bin/g++-4.0 -o
/Users/tridiak/Programming/Directory_Tree/DirTree/DTPlugins/DTBundlePlugin/build/Debug/DTBundlePlugin.bundle/Contents/MacOS/DTBundlePlugin
-L/Users/tridiak/Programming/Directory_Tree/DirTree/DTPlugins/DTBundlePlugin/build/Debug
-L/Users/tridiak/Programming/Directory_Tree/DirTree/DTPlugins/DTBundlePlugin
-L/Users/tridiak/Programming/Directory_Tree/DirTree/DTPlugins/DTBundlePlugin/../../build/Development
-F/Users/tridiak/Programming/Directory_Tree/DirTree/DTPlugins/DTBundlePlugin/build/Debug -filelist
/Users/tridiak/Programming/Directory_Tree/DirTree/DTPlugins/DTBundlePlugin/build/DTBundlePlugin.build/Debug/DTBundlePlugin.build/Objects-normal/i386/DTBundlePlugin.LinkFileList -framework Carbon
-arch i386 -Wl,-Y,1455 -bundle -mmacosx-version-min=10.4
-bundle_loader
/Users/tridiak/Programming/Directory_Tree/DirTree/build/Development/DirTree.app/Contents/MacOS/DirTree -isysroot
/Developer/SDKs/MacOSX10.4u.sdk
_______________________________________________
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