• 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
Loading/Unloading a Cocoa-using framework from a CFM application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Loading/Unloading a Cocoa-using framework from a CFM application


  • Subject: Loading/Unloading a Cocoa-using framework from a CFM application
  • From: David Elliott <email@hidden>
  • Date: Thu, 22 Apr 2004 15:01:59 -0400

Hi,

I've got a Photoshop plugin written using wxWindows for Mac (Carbon) which had been compiled as CFM with CodeWarrior. Recently it has been decided that wxMac should focus mostly on OS X which necessitates Mach-O format because of the features only available when using Mach-O on OS X >= 10.2.

In light of this I have decided to rework the plugin such that it is a very simple stub which loads a Mach-O framework to do the work. The framework is linked statically with wxWindows so it only imports from system frameworks and only exports one entrypoint (PluginMain).

Since I am the developer of wxCocoa I decided it might be fun to try using wxCocoa instead of wxMac. Surprisingly enough it works pretty well. The framework loads, its entry point is called and it actually shows the about box! Where I have trouble is when the framework returns back to the CFM code and the CFM code unloads the bundle I get the following message:

objc: cannot unmap an image containing ObjC data

I searched for that and actually found some code from Darwin online (objc-runtime.m) and a cursory glance seems to indicate that some things are being initialized when the library is loaded but that they aren't cleaned up when it's unloaded. Is there some code I could add to clean things up so the framework can unload cleanly?

I am also wondering (and this may be offtopic) how to call Photoshop functions. Photoshop gives the plugin some structs containing function pointers with pascal calling conventions. I have seen the CFM_MachO_CFM sample and of course the loading of the Mach-O framework is based on this. The CFM_MachO_CFM sample has MachOFunctionPointerForCFMFunctionPointer and it uses it on a function that has C calling conventions both in the CFM part and the Mach-O part. Is the MachOFunctionPointerForCFMFunctionPointer agnostic about the calling conventions or is it dependent upon C calling conventions? What I need to do is have Mach-O code which is calling a function pointer with Pascal conventions call into the Photoshop code which is CFM with Pascal calling conventions.

Thanks,
-Dave
_______________________________________________
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.


  • Follow-Ups:
    • Re: Loading/Unloading a Cocoa-using framework from a CFM application
      • From: Florent Pillet <email@hidden>
    • Re: Loading/Unloading a Cocoa-using framework from a CFM application
      • From: Dave Rehring <email@hidden>
    • Re: Loading/Unloading a Cocoa-using framework from a CFM application
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Re: Newbie: Cannot use object as a parameter to a method
  • Next by Date: Re: Newbie: Cannot use object as a parameter to a method
  • Previous by thread: Re: Newbie: Cannot use object as a parameter to a method
  • Next by thread: Re: Loading/Unloading a Cocoa-using framework from a CFM application
  • Index(es):
    • Date
    • Thread