• 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: Using assembly in objective-c
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using assembly in objective-c


  • Subject: Re: Using assembly in objective-c
  • From: Twisted Theory Software <email@hidden>
  • Date: Mon, 21 Jan 2008 13:58:48 -0600


On 21 Jan, 2008, at 1:36 PM, glenn andreas wrote:


On Jan 21, 2008, at 12:58 PM, Twisted Theory Software wrote:

I'm still trying, without luck, to use CoreMenuExtraAddMenuExtra() from HIServices. I know it's still in there, because otool shows it: in the appropriate directory,

% otool -Vt HIServices | grep CoreMenu
_CoreMenuExtraGetMenuExtra:
_CoreMenuExtraAddMenuExtra:
_CoreMenuExtraRemoveMenuExtra:

Given that I can see the actual assembly-language instructions in this file using otool, can I somehow use that to define the function? That is, in my program, can I write something like

int CoreMenuExtraGetMenuExtra(...) {

return gccUseAssemblyString( assembly from otool );

}

Thanks,


Please don't. It's not a publicly document routine - you shouldn't be it.

In order to use something like this from assembly (or at all, for that matter) you need to know what all the parameters are (type, size) and what they are used for. CoreMenuExtraAddMenuExtra is a private SPI - so you know none of these. Calling a routine by randomly passing parameters is a good way to make things crash - worse, if not your app, potentially somebody else's app. Even if you get it to work, unless you understand what all the parameters are (and the side effects of the routine) you have no idea if it will continue to work on future OS versions
(resulting in the "don't upgrade to this version of the OS because it's buggy" mentality - when in fact it is some third party app that causes the problems, not the OS),

The parameters are well-known, as this routine has been used in several older programs; the extremely popular MenuMeters, for example.


-- snip --

In this particular case, Apple doesn't support third parties writing MenuExtra's - use an NSStatusItem. While the two aren't exactly the same (there are some subtle behavioral differences, such as being able reorder them), they should be adequate. What specific functionality do you need to use a MenuExtra for that you aren't getting from an NSStatusItem? (And have you filed an enhancement request bug to add that functionality? If you don't ask, don't expect it to be added)

I will file an enhancement request.

To be honest, I only develop software that I want to use, either because it doesn't exist, or the existing stuff doesn't do what I want or work how I think it should work. I'm glad if other people like it, but if it doesn't work for them, I won't lose any sleep.

What I want is a replacement for the menu-bar clock, that displays time how I want it, and drops down a nice-looking, adjustable calendar when clicked. I don't like the way other programs look, or if I do they aren't free (which, by the way, all use NSMenuExtra implementations). Having a clock that moves depending on the other NSStatusItems that happen to be visible at the time is annoying: UI elements that I glance at all the time should not be moving around. It would be best if the time were right next to spotlight, or better yet, drop the spotlight icon entirely and have the clock in its place. This cannot be accomplished with NSStatusItem.

Josh
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Using assembly in objective-c
      • From: "Kyle Sluder" <email@hidden>
References: 
 >Using assembly in objective-c (From: Twisted Theory Software <email@hidden>)
 >Re: Using assembly in objective-c (From: glenn andreas <email@hidden>)

  • Prev by Date: Re: Using assembly in objective-c
  • Next by Date: Re: Leopard - interaction with Spaces from own applications
  • Previous by thread: Re: Using assembly in objective-c
  • Next by thread: Re: Using assembly in objective-c
  • Index(es):
    • Date
    • Thread