• 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
objc_msgSend_stret Intel crashes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

objc_msgSend_stret Intel crashes


  • Subject: objc_msgSend_stret Intel crashes
  • From: "Tim Conkling" <email@hidden>
  • Date: Sat, 24 Jun 2006 16:54:25 -0400

I'm not sure if this message is appropriate to this list -- it's a question
about the Objective-C runtime, and not necessarily strictly a Cocoa question
-- but I wasn't sure where else to post it.

I'm porting some code that uses the objc-runtime to a Universal Binary (yes,
it's an APE haxie -- don't hate me!). Calls to objc_msgSend_stret are
causing crashes on Intel Macs. I've been scouring Google for information on
this problem, and the only semi-useful information that shows up is this
page from Apple:
<http://tuvix.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_tips/chapter_5_section_23.html>
-- specifically, the sentence that says, "When you call objc_msgSend_stret ,
you must cast the function to a function pointer type that uses the expected
struct return type."

I have some calls to -[NSWindow frame] that originally looked like this:

objc_msgSend_stret( &origWindowFrame, window,
NSSelectorFromString(CFSTR("frame"))
);

I changed them to this:

origWindowFrame = (*(NSRect(*)(void*, void*, ...))
objc_msgSend_stret)(window, NSSelectorFromString(CFSTR("frame")));

And eliminated crashes associated with those calls to objc_msgSend_stret.
However, there are other calls to the function that are still failing. For
example, I changed this code:

objc_msgSend_stret(&origMousePos, gNSEventClass,
NSSelectorFromString(CFSTR("mouseLocation")));

to this:

origMousePos = (*(NSPoint(*)(void*, void*, ...))
objc_msgSend_stret)(gNSEventClass,
NSSelectorFromString(CFSTR("mouseLocation")));

This line crashes every time (as does the original code).

Any hints on what I'm doing wrong here?


Thanks! Tim _______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Helper Tool on FireWire
  • Next by Date: Re: Helper Tool on FireWire
  • Previous by thread: Re: Helper Tool on FireWire
  • Next by thread: Re: objc_msgSend_stret Intel crashes
  • Index(es):
    • Date
    • Thread