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

Developer

Forums

Forums:

Has anyone tried anything with the STL in BREW? I just noticed that the ADS has the STL headers included with it. (Or at least I think it does.)

I'm sort of new to the STL and will be taking a stab at some stuff when I get a chance, but I thought I'd ask the board to see if anyone else had any experience with it.

RC

TL won’t work in BREW because of the restrictions on Static/Global data. You would need to have template classes among other things which will not work. Maybe I am misunderstanding your intentions. If so please let me know.
--Kevin Warmerdam
BREW Support

TL won’t work in BREW because of the restrictions on Static/Global data. You would need to have template classes among other things which will not work. Maybe I am misunderstanding your intentions. If so please let me know.
--Kevin Warmerdam
BREW Support

Thanks, Kevin!

Thanks, Kevin!

We used a class that implements a linked list, and we use templates. We tested it in various devices and it worked really well... Am I missing something when you say that template classes don't work?

We used a class that implements a linked list, and we use templates. We tested it in various devices and it worked really well... Am I missing something when you say that template classes don't work?

I was more interested in container classes like vector, map, list, etc.
If you have those working, let me know! : )

I was more interested in container classes like vector, map, list, etc.
If you have those working, let me know! : )

Template Classes should produce Static data. When I tried it, I got linker errors. What ADS are you using? If you are using 1.1 and don't have the appropriate flags set the compile may pass, but you could see random crashing in your application.

Template Classes should produce Static data. When I tried it, I got linker errors. What ADS are you using? If you are using 1.1 and don't have the appropriate flags set the compile may pass, but you could see random crashing in your application.

Hi Kevin,
As far as I know templates only generate code at compile-time based on types provided by the user - how can they produce "static data"?
Radu

Hi Kevin,
As far as I know templates only generate code at compile-time based on types provided by the user - how can they produce "static data"?
Radu

We're using ADS 1.2... As far as I know it deals very well with template classes... Could it be a problem when applying to true brew testing?

We're using ADS 1.2... As far as I know it deals very well with template classes... Could it be a problem when applying to true brew testing?

I tested this a while back and thought that static data was the issue. I will have to take another look at it. Sorry for the confusion. If you guys got it working that’s great.

I tested this a while back and thought that static data was the issue. I will have to take another look at it. Sorry for the confusion. If you guys got it working that’s great.

Kevin,
While you are testing it do you mind looking into the container class issue? It would be nice to have access to modern containers like vector, map, list, etc. There may be an overhead issue to worry about, but it would still be nice if possible.
Thanks,
Rich

Kevin,
While you are testing it do you mind looking into the container class issue? It would be nice to have access to modern containers like vector, map, list, etc. There may be an overhead issue to worry about, but it would still be nice if possible.
Thanks,
Rich

Kevin and others,
I've had the same issue which has been plaquing for days. In the Brew documentation it was made clear that we couldn't use inheritance, virtual, and other OOP mechanisms that generate static/global data at runtime. I found this to be a contradiction to known facts. When in doubt, please take a look at the "cppapp" demo in the Brew 1.1 sdk, that uses virtual and inheritance alright. Am I missing something here?
With regards to STL I thought also that templates are expanded at compile-time, hence has little (if at all) to do with static / global data being produced.
Most of my codes make use virtual and inheritance mechanisms in C++, and they run fine on my T720. I am about to add STL too. And the biggest concern to me was whether doing so would prevent me from passing the true Brew testing?
Thanks and I appreciate your time looking into this.
Cheers,
Joe

Kevin and others,
I've had the same issue which has been plaquing for days. In the Brew documentation it was made clear that we couldn't use inheritance, virtual, and other OOP mechanisms that generate static/global data at runtime. I found this to be a contradiction to known facts. When in doubt, please take a look at the "cppapp" demo in the Brew 1.1 sdk, that uses virtual and inheritance alright. Am I missing something here?
With regards to STL I thought also that templates are expanded at compile-time, hence has little (if at all) to do with static / global data being produced.
Most of my codes make use virtual and inheritance mechanisms in C++, and they run fine on my T720. I am about to add STL too. And the biggest concern to me was whether doing so would prevent me from passing the true Brew testing?
Thanks and I appreciate your time looking into this.
Cheers,
Joe

In fact, we have working STL port for BREW and we have extension that passed True BREW that is using our STL port.
As far as I know, the biggest issue with STL is that it's potentially unsafe, since lack of exceptions and therefore unavailability of memory allocation problem reporting.
But anyway it works, and if community is intrested I think we can even publish it as open-source.

In fact, we have working STL port for BREW and we have extension that passed True BREW that is using our STL port.
As far as I know, the biggest issue with STL is that it's potentially unsafe, since lack of exceptions and therefore unavailability of memory allocation problem reporting.
But anyway it works, and if community is intrested I think we can even publish it as open-source.

I for one am very interested. Please consider releasing the STL port for brew.
rc

I for one am very interested. Please consider releasing the STL port for brew.
rc

Well. I think we will release it some day, just need to find a time to prepare it for public release.
Want to mention though that for commercial application I will not suggest to use STL, since it's awesome for prototyping, doing quick spikes or demo versions, but it significantly increases application size. Not STL itself, but all instances of templated classes. So difference in size is sometimes 25-30%.

Well. I think we will release it some day, just need to find a time to prepare it for public release.
Want to mention though that for commercial application I will not suggest to use STL, since it's awesome for prototyping, doing quick spikes or demo versions, but it significantly increases application size. Not STL itself, but all instances of templated classes. So difference in size is sometimes 25-30%.

Xenocid,
Would you mind posting the general "recipe" you used to get the STL to work in BREW? Did you use STLPort or another library?
Thanks,
RC

Xenocid,
Would you mind posting the general "recipe" you used to get the STL to work in BREW? Did you use STLPort or another library?
Thanks,
RC

OK I think I may have figured this one out somewhat.
The ARM compiler chokes when you say:
vector my_ints;
because it doesn't understand namespaces, so the namespace inside vector that defines what allocator to use can't be resolved or something.
If you say:
vector > my_ints;
It compiles nicely. I haven't actually done anything with this other than get it to compile, but it does compile under ARM and I have heard from BREW support that while they don't explicitly support STL, if you adhere to the testing lab standards for behavior, STL shouldn't matter.

OK I think I may have figured this one out somewhat.
The ARM compiler chokes when you say:
vector my_ints;
because it doesn't understand namespaces, so the namespace inside vector that defines what allocator to use can't be resolved or something.
If you say:
vector > my_ints;
It compiles nicely. I haven't actually done anything with this other than get it to compile, but it does compile under ARM and I have heard from BREW support that while they don't explicitly support STL, if you adhere to the testing lab standards for behavior, STL shouldn't matter.

Hi Rich,
vector is declared in STL as
template >
class vector
: public _Vector_val<_Ty, _Ax>
so I cannot see any way to use it as:
vector myInt;
or std::vector myInt;
other than
typedef std::vector vector;
vector myInt ;
or in a non-standard port.
BTW: What STL port did you use?
Radu

Hi Rich,
vector is declared in STL as
template >
class vector
: public _Vector_val<_Ty, _Ax>
so I cannot see any way to use it as:
vector myInt;
or std::vector myInt;
other than
typedef std::vector vector;
vector myInt ;
or in a non-standard port.
BTW: What STL port did you use?
Radu

Wierd my code got corrupted by the Board.
vector myints
what what I meant. : )
Sorry for the confusion. I'm just using the STL that comes with the ARM compiler.

Wierd my code got corrupted by the Board.
vector myints
what what I meant. : )
Sorry for the confusion. I'm just using the STL that comes with the ARM compiler.

Hey my code keeps getting mangled by the boards...it doesn't like the angle brackets.
How are you guys getting the angle brackets into your posts?
If I put something into the post wrapped in vb Code square braces, it doesn't work.
In fact, I just tried to put the snippet quoted in the vB Code help into this post and it popped up a window saying "Hello World!" on my screen. Weird.

Hey my code keeps getting mangled by the boards...it doesn't like the angle brackets.
How are you guys getting the angle brackets into your posts?
If I put something into the post wrapped in vb Code square braces, it doesn't work.
In fact, I just tried to put the snippet quoted in the vB Code help into this post and it popped up a window saying "Hello World!" on my screen. Weird.

vector myints;
You have to use the html symbol codes for < and &#62.
They are 60 and 62 respectively.
e.g. for less than: &#60&#59
Regards,
Murray

vector myints;
You have to use the html symbol codes for < and &#62.
They are 60 and 62 respectively.
e.g. for less than: &#60&#59
Regards,
Murray

Thanks Murray! You rule.
Anyway, here's what I did that works for me as far as compiling with vector.h included:
vector&#60int, allocator&#60int&#62 &#62 myints;
Again...I just got this to compile. I haven't actually used it for anything yet (no time) but I will try to soon.

Thanks Murray! You rule.
Anyway, here's what I did that works for me as far as compiling with vector.h included:
vector&#60int, allocator&#60int&#62 &#62 myints;
Again...I just got this to compile. I haven't actually used it for anything yet (no time) but I will try to soon.

Oh yeah, also you can use:
using namespace std;
for compilation on Windows, but when you go to the ARM compiler it will complain about this. It just warns you, doesn't actually call it an error.

Oh yeah, also you can use:
using namespace std;
for compilation on Windows, but when you go to the ARM compiler it will complain about this. It just warns you, doesn't actually call it an error.