• 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: Global array, fails under dynamic, works under static build
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Global array, fails under dynamic, works under static build


  • Subject: Re: Global array, fails under dynamic, works under static build
  • From: Peter O'Gorman <email@hidden>
  • Date: Thu, 21 Jun 2007 16:36:41 -0500

On Thu, 2007-06-21 at 11:13 -0700, email@hidden wrote:
> I have a library which I have built under both Static and Dynamic builds.
>
> When I include the library in my application the Dynamic build version fails during
> runtime, my Static build works as expected.
>
> Specifically I have an array of pointers to a structure which is declared
> globally. When I assign a pointer to an array element the array in the Static build
> accepts the pointer, the array in the Dynamic build remains unchanged.
>
> // In the same file:
>
> // DMFModuleInfo is a structure,
> // L1MODULE_COUNT = 12
> DMFModuleInfo *gDMFModules[L1MODULE_COUNT];
>
> // ModuleID & n are integers, init->moduleInfo[
> // contains an array of pointers to DMFModuleInfo structures.
>
> // The line which fails is
> gDMFModules{ModuleID] = init->moduleInfo[n];

I think you wanted a '[' there :)

When you say "remains unchanged" do you mean, was NULL and stays NULL
after the assignment? When you look at it in the debugger, do you see it
setting init->moduleInfo to something before it reaches this point in
your code?

It is possible that things get initialized in a different order for
dynamic and static builds (although this is less likely on 10.4 and
later thanks to the new dyld) and that is causing your problem.

Hope this helps (at least a little),
Peter
 _______________________________________________
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: 
 >Global array, fails under dynamic, works under static build (From: email@hidden)

  • Prev by Date: Re: "Statement with no effect" warning
  • Next by Date: Re: Problem with Currency Converter tutorial
  • Previous by thread: Global array, fails under dynamic, works under static build
  • Next by thread: Problem with Currency Converter tutorial
  • Index(es):
    • Date
    • Thread