Obj-C in a dylib
Obj-C in a dylib
- Subject: Obj-C in a dylib
- From: "Thomas L. Davis" <email@hidden>
- Date: Mon, 3 May 2004 10:20:03 -0500
This may be OT, but I'm sure where to ask...
I'm trying to build a MATLAB MEX-file (a dylib I think) that uses the
MacOS X Foundation, CoreFoundation and IOKit frameworks. The MEX-file
builds and (mostly) works okay. But I get a crash when the MEX-file is
cleared:
>> clear all
>> mtune init % mtune is my MEX-file
>> clear mtune
objc: cannot unmap an image containing ObjC data
Trace/BPT trap
The top of the crash log stack looks like this:
Thread 0 Crashed:
0 libobjc.A.dylib 0x9083be80 _objc_trap + 0
1 libobjc.A.dylib 0x9083be14 _objc_fatal + 0x48
2 libobjc.A.dylib 0x90837c44 _objc_fatalHeader + 0x44
3 dyld 0x8fe185d4 call_funcs_for_remove_image +
0x8c
4 dyld 0x8fe13534 _dyld_unlink_module + 0xcc
5 libSystem.B.dylib 0x9003d7c8 NSUnLinkModule + 0x68
6 libdl.dylib 0x000bf9cc dlclose + 0xc0
7 libmex.dylib 0x000b9248 mexClearMexFileDefault + 0x48
8 libmex.dylib 0x000b8b38 mexClearMexFile + 0x30
I think the basic problem is that MATLAB doesn't use the Obj-C runtime
but my MEX-file does. Evidently the runtime does not like to be
unlinked by NSUnLinkModule.
Is there a solution to this problem?
Here's the way the MEX-file is linked in Xcode 1.2:
StandaloneExecutable.LinkUsingFileList
/Users/tom/apps/MTuner/build/mtune.mexmac
/usr/bin/gcc3 -o /Users/tom/apps/MTuner/build/mtune.mexmac
"-L/Users/tom/apps/MTuner/build" "-L/Applications/MATLAB/bin/mac"
"-F/Users/tom/apps/MTuner/build" "-F/Users/tom/Library/Frameworks"
-filelist
/Users/tom/apps/MTuner/build/MTuner.build/MATLAB.build/Objects-normal/
LinkFileList "-arch" "ppc" "-Wl,-no_arch_warnings" "-bundle"
"-Wl,-flat_namespace" "-undefined" "suppress" "-framework"
"CoreFoundation" "-framework" "Foundation" "-framework" "IOKit"
Thanks,
Tom
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.