• 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
Sending messages to Objective C objects at runtime
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sending messages to Objective C objects at runtime


  • Subject: Sending messages to Objective C objects at runtime
  • From: Vincent Coetzee <email@hidden>
  • Date: Sun, 1 Feb 2004 09:57:04 +0200

Hi there

This may be a dumb question, I am not sure, and in my assembler days I may have known the answer, so please excuse me up front if it IS stupid. I need to invoke an operation on an Objective C Object from within C code. The selector is not known in advance and neither are the types or number of arguments. When initially considering this problem I thought it was easy I saw that there were C functions to send messages to Objective C objects. The problem is that the objc_msgSend is typed as

id objc_msgSend(id receiver, SEL selector,...)

My problem is how do I dynamically create a va_args, so that I can use this function and push the appropriate arguments onto the stack. I suppose an alternative mechanism would be to use NSInvocation, but that looks frightfully HEAVY. Does anyone know how to fiddle va_args in Objective C, or am I missing something really obvious.

Thanks in advance

Vincent
_______________________________________________
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: Sending messages to Objective C objects at runtime
      • From: Chris Hanson <email@hidden>
    • Re: Sending messages to Objective C objects at runtime
      • From: Sherm Pendley <email@hidden>
  • Prev by Date: Updating text fields in Cocoa.
  • Next by Date: Re: Does NSImageView dispose of it's image
  • Previous by thread: Re: CURLHandle and making directories on remote host
  • Next by thread: Re: Sending messages to Objective C objects at runtime
  • Index(es):
    • Date
    • Thread