• 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
Frameworks and global variables
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Frameworks and global variables


  • Subject: Frameworks and global variables
  • From: Christian Mike <email@hidden>
  • Date: Thu, 12 Jul 2001 10:23:20 -0500

I am trying to access a global variable defined in a framework from an
application. For example, I have a simple Cocoa framework that contains:

char *string[] = "Some String";
long value = 1234;

void Frame1Routine()
{
NSLog(@"Frame 1 message");
// code and stuff
}

Now in my application, I have added the framework to the project. I know
that the framework is getting included properly, because I can call
Frame1Routine from my application, and the NSLog message is printed.

Now, if within my application I declare:

extern char *string;
extern long value;

and try to reference them from my application, it crashes with:

FinalApp.app has exited due to signal 11 (SIGSEGV).

In fact that same error happens even if I try to access those "global"
variables from within the Frame1Routine!

As another piece of information, when I build the application, I get the
following linker warning:

warning prebinding disabled because dependent library:
(HOME)/Library/Frameworks/Frame1.framework/Versions/A/Frame1 is not prebound

How to I access "global" variables from outside (or even inside!) a
framework?

Is that linker warning of any concern?

Are these two related?

Thanks.

Michael Christian
Thomson multimedia Inc.


  • Prev by Date: Re: Image Scaling Code
  • Next by Date: Re: NSPopUpButton Problem
  • Previous by thread: Re: Frameworks and global variables
  • Next by thread: Re: Frameworks and global variables
  • Index(es):
    • Date
    • Thread