Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

I have a big, third-party library that makes extensive use of global variables to store state. I can't change this.

I've been trying to find out whether it can be ported to Brew. So, I've been trying to find out whether global variables are supported these days.

Unfortunately I've been totally unable to find an actual answer. Some places say that they're not supported at all, some places say that they work fine if you compile as ELF and use elf2mod, some say that they don't work on the simulator, some say that only const variables are supported... searching the forums just leads to lots of rather confused discussion.

Does anyone have any definitive information as to whether they work or not?

This is all in C (not C++), on Brew 4.

Global variables are supported with BREW MP mod1 format but their public (extern) visibility is limited to the scope of the mod1 that creates them.
If you wish to access them from other modules you will need accessor interfaces..

Global variables are supported with BREW MP mod1 format but their public (extern) visibility is limited to the scope of the mod1 that creates them.
If you wish to access them from other modules you will need accessor interfaces..

Well, as I'm using Brew 4, Brew MP features don't help much!
Can I use elf2mod to get global variables with class mod files? And yes, I'm only interested in scope within a single binary.

Well, as I'm using Brew 4, Brew MP features don't help much!
Can I use elf2mod to get global variables with class mod files? And yes, I'm only interested in scope within a single binary.

Sorry David,  I don't have any direct experience with Brew 4.

Sorry David,  I don't have any direct experience with Brew 4.

I can defintely told you that: it support.
not only brew mp, but also brew 4 and brew 3.
you can take a referene in this web site:
http://blog.csdn.net/miyunhong/archive/2010/04/15/5490399.aspx
(chinese version, i think you can get a general idea from it)
 
rememeber, you should use the elf2mod in brewmp sdk, don't use brew315 elf2mod, it have bug in calculate the length of ZI section.

I can defintely told you that: it support.
not only brew mp, but also brew 4 and brew 3.
you can take a referene in this web site:
http://blog.csdn.net/miyunhong/archive/2010/04/15/5490399.aspx
(chinese version, i think you can get a general idea from it)
 
rememeber, you should use the elf2mod in brewmp sdk, don't use brew315 elf2mod, it have bug in calculate the length of ZI section.

Thanks --- very helpful! And might I suggest that a cleaned up version of this would be a good FAQ?
If the Brew 3.15 version of elf2mod doesn't work, and the Brew MP version does work, does anyone know whether the Brew 4.02 version works or not? (This is the one at https://developer.brewmp.com/file/2263/elf2mod.exe, version 1.0.2.)

Thanks --- very helpful! And might I suggest that a cleaned up version of this would be a good FAQ?
If the Brew 3.15 version of elf2mod doesn't work, and the Brew MP version does work, does anyone know whether the Brew 4.02 version works or not? (This is the one at https://developer.brewmp.com/file/2263/elf2mod.exe, version 1.0.2.)

hi:
it have no sense to get the answer of " does anyone know whether the Brew 4.02 version works or not", since the elf2mod in BrewMp defenitely works! and it can be used in brew315 & brew4.

hi:
it have no sense to get the answer of " does anyone know whether the Brew 4.02 version works or not", since the elf2mod in BrewMp defenitely works! and it can be used in brew315 & brew4.

Unfortunately, for reasons that are too complicated to go into here, I have the Brew 4 SDK only. So knowing whether the Brew MP version works doesn't help me.
How can I find out whether elf2mod is working correctly --- is it obvious (i.e., nothing works) or subtle (data corruption)? Is the mod format documented anywhere so I can go and look at whether the fixups are set correctly?

Unfortunately, for reasons that are too complicated to go into here, I have the Brew 4 SDK only. So knowing whether the Brew MP version works doesn't help me.
How can I find out whether elf2mod is working correctly --- is it obvious (i.e., nothing works) or subtle (data corruption)? Is the mod format documented anywhere so I can go and look at whether the fixups are set correctly?

After trying it, I now know that the Brew 4 SDK's elf2mod (version 1.0.2.02) does *not* work and that applications just crash if you try it.
The Brew MP version (2.0.0.3) does work.

After trying it, I now know that the Brew 4 SDK's elf2mod (version 1.0.2.02) does *not* work and that applications just crash if you try it.
The Brew MP version (2.0.0.3) does work.