• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Obj-C in a dylib
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Obj-C in a dylib


  • Subject: Re: Obj-C in a dylib
  • From: "Thomas L. Davis" <email@hidden>
  • Date: Mon, 3 May 2004 17:46:49 -0500

Actually, I found a fifth way. The MATLAB external API provides a call to lock a MEX-file so that it can't be cleared from memory. I feel pretty dumb not finding this earlier.

Tom

On May 3, 2004, at 12:01 PM, Bob Ippolito wrote:


On May 3, 2004, at 11:20 AM, Thomas L. Davis wrote:

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:

It's not a dylib, a bundle (MH_BUNDLE). MH_DYLIB isn't unloadable at all, whether or not you are using ObjC, and they are loaded with a different API (or automatically by the runtime linker).

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?

Several, none of them good, but here are a few off the top of my head.

- Don't use clear
- Don't use Obj C
- Make your MEX file load all of its Obj C functionality at runtime from a second bundle or dylib which you do not unload
- Do an evil runtime hack to replace the current implementation of NSUnLinkModule with something else that'll do a no-op if there if ObjC code in there (you'll probably want to read through the darwin source code for the ObjC runtime and dyld in this case).

-bob
_______________________________________________
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.


References: 
 >Obj-C in a dylib (From: "Thomas L. Davis" <email@hidden>)
 >Re: Obj-C in a dylib (From: Bob Ippolito <email@hidden>)

  • Prev by Date: Re: Script-recording in Mail
  • Next by Date: Word Count Problem
  • Previous by thread: Re: Obj-C in a dylib
  • Next by thread: Bug in NSCalendarDate?
  • Index(es):
    • Date
    • Thread