Skip navigation.
 
ml[OT] Re: Using assembly in objective-c
FROM : Alastair Houghton
DATE : Tue Jan 22 14:18:31 2008

On 22 Jan 2008, at 00:26, Twisted Theory Software wrote:

> On 21 Jan, 2008, at 5:00 PM, Andrew Farmer wrote:
>

>> For the sake of brevity, I'll give a general answer. [Insert a 
>> bunch of dire warnings about using private frameworks here.] A C(*) 
>> function called xyzzy() will generate a symbol named _xyzzy. It can 
>> be called by simply declaring and calling a function called 
>> xyzzy(); no wrapper (or assembly!) is necessary.
>>

> Yes, but you still have to link against some library containing 
> xyzzy().  For the function I'm after is located in 
> HIServices.framework, but linking against 
> ApplicationServices.framework, its umbrella, results in a symbol not 
> found error. This worked before, on Tiger, when they were seperate 
> frameworks.
>
> What I'm asking is can I use the assembly from the HIServices 
> library (the binary file) in a function.  If so, how?



If you have the code, you can read it to work out what it does, then 
write equivalent C code (or, if you *really* want, include it as 
inline assembly).  Most likely this approach won't work, however, 
because it very probably calls other routines and/or uses other 
symbols in the HIServices framework.  It would only really work in 
trivial cases.

If there isn't a supported way to do what you want, as others have 
said already, you should file a bug report asking for one.  The reason 
the linker prevents you from linking against subframeworks is 
precisely so that you can't easily call SPIs; doing that makes Apple's 
job much harder because it can create compatibility issues where none 
should exist.  Sometimes they may be able to get application 
developers to address these, but on other occasions they will end up 
having to add gross workarounds to Mac OS X itself, which is *nasty*.

In any case, this question is off-topic, because it isn't about Cocoa.

Kind regards,

Alastair.

--
http://alastairs-place.net

Related mailsAuthorDate
mlUsing assembly in objective-c Twisted Theory Sof… Jan 21, 19:58
mlRe: Using assembly in objective-c glenn andreas Jan 21, 20:36
mlRe: Using assembly in objective-c Twisted Theory Sof… Jan 21, 20:58
mlRe: Using assembly in objective-c Kyle Sluder Jan 21, 21:38
mlRe: Using assembly in objective-c Twisted Theory Sof… Jan 21, 21:46
mlRe: Using assembly in objective-c Andrew Farmer Jan 22, 00:00
mlRe: Using assembly in objective-c Twisted Theory Sof… Jan 22, 01:26
mlRe: Using assembly in objective-c Andrew Farmer Jan 22, 01:35
ml[OT] Re: Using assembly in objective-c Alastair Houghton Jan 22, 14:18