• 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: How to load my framework programatically ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to load my framework programatically ?


  • Subject: Re: How to load my framework programatically ?
  • From: "rohit dhamija" <email@hidden>
  • Date: Thu, 25 May 2006 19:28:57 +0530

Hi Jonathon
>>I'm not sure what you mean here; can you give an example of an
>>initialize/terminate routine?
 
 intialize and terminate routines are the constructors and desctructors that get called up when a framework is loaded and unloaded
 
// The constructors and destructor attributes are supported by gcc as of version 2.5
extern void InitializeModule(void) __attribute__ ((constructor));
extern void TerminateModule (void) __attribute__ ((destructor));
 
void InitializeModule(void){
printf("This string gets printed when the framework gets loaded");
}
 
void TerminateModule (void){
printf("This string gets printed when the framework gets UNloaded, i.e. when application closes");
}

 

All comments/suggestions are welcome.
Rohit

 
On 5/25/06, Jonathon Mah <email@hidden> wrote:
Hi Rohit,

> Thanks for your reply. Also, it would be great if you could clarify/
> suggest below concerns too
>
> 1. We no longer need to link the framework explicitly, i.e. gcc
> myuseApp.c -framework myFramework.framework. Is that correct ?

If you want to use functions or classes from that framework, you need
to link to it (with -framework).

> 2. Also,if I just specify the header file and use the function I
> require from framework, then will the  "initialize routines" and
> "terminate routine" of the framework  be called automatically.

I'm not sure what you mean here; can you give an example of an
initialize/terminate routine?

> Actually we have  routine(s) that get called up when the framework
> gets loaded and unloaded respectively.

I don't think of the framework as getting "loaded"; rather it's a
pile of code that your program can use if it wants. In Mac OS X, code
is never unloaded; once it's loaded, it's there to stay until the
program exits.

I'm not completely confident in this answer though; someone else will
be better able to answer. There are exceptions too, such as classes
in a loaded framework being all send the +load message.


Jonathon Mah
email@hidden





--
Rohit Dhamija(M) 9818446545
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >How to load my framework programatically ? (From: "rohit dhamija" <email@hidden>)
 >Re: How to load my framework programatically ? (From: Jonathon Mah <email@hidden>)
 >Re: How to load my framework programatically ? (From: "rohit dhamija" <email@hidden>)
 >Re: How to load my framework programatically ? (From: Jonathon Mah <email@hidden>)

  • Prev by Date: Re: How to load my framework programatically ?
  • Next by Date: Re: How to load my framework programatically ?
  • Previous by thread: Re: How to load my framework programatically ?
  • Next by thread: Re: How to load my framework programatically ?
  • Index(es):
    • Date
    • Thread