• Advertisement
Sign in to follow this  

static member functions - statics removed still doesn't initialize (HELP PLEASE!!!)

This topic is 4593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all I have a MAJOR problem. My app is trashing the stack before it is initialized, therfore it can never start as the stack is oblitrated. I've been told that this can be caused by large global/static variables. Is this also true with static member functions? Ther code I've got is based on the Enginuity engine and some of the classes have lots of static member functions. Would it be sensible to replace these with public member functions. I know that I'd have to then use them through an instansiated objected of the class, but might this be the cause of my stack issues? [Edited by - garyfletcher on July 29, 2005 4:49:49 PM]

Share this post


Link to post
Share on other sites
Advertisement
No. Static member functions would not cause problems like that.

Share this post


Link to post
Share on other sites
Right.

I believe that is some other statics I have.

I'm just going through now and refactoring to member vars.

One question though. If I have a var declared:

static boost::shared_ptr<aClass> aName;

Coudl this cause the major stack issues I've been seeing. I must admit my knowledge of the stack is pretty limited.

Share this post


Link to post
Share on other sites
Okay...this is not funny anymore!!

I've got rid of ALL statics...variables, functions EVERYTHING!!!

And my app is still not initializing. Can ANYONE give me any lead on what to look for.

Application Error Pop-up states:

The application failed to initialize properly (0x0000005). Click on OK to terminate the application.

In the debugger I get:

Selecting target: default
Compiling: done
Starting debugger: done
Adding source dir: C:\cvshome\SiSE\NewEngineCB\devAdding file: enginedev.exe
Changing directory to: C:/cvshome/SiSE/NEWENG~3/dev
Program received signal (SIGSEGV)
Segmentation fault
error
Error: dll starting at 0x3d1000 not found.
Program received signal (SIGSEGV)
Segmentation fault
Program received signal (SIGSEGV)
Segmentation fault
exited -1073741819
error
Debugger finished with status 0

I'm using the latest of code::blocks (RC1) with XP.

Please help.


Share this post


Link to post
Share on other sites
Try compiling Hello World. If it doesn't work, re-install your compiler and/or get a new one.

Share this post


Link to post
Share on other sites
Hello World works fine...boo hoo!!!!

This is a bit of a 'mare!!

Guess it's back to the drawing board!!!!

Share this post


Link to post
Share on other sites
I'm confused.... can't you just run your app in the debugger and *see* where it's failing? main is NOT the first function that runs.

Share this post


Link to post
Share on other sites
It isn't?

I'm confused then. I though that main() was the entry point....where else could I put a breakpoint?

Share this post


Link to post
Share on other sites
You don't need to put a breakpoint. When a segfault occurs, the compiler will dump you wherever the segfault happened.

main() is the entrypoint, but other things happen before main(), such as constructors of global objects.

Share this post


Link to post
Share on other sites
Right.

It seems to be failng in SDL_Main.

Thanks for the advise...will have to just see what I can see..:)

Share this post


Link to post
Share on other sites
For what its worth (probably not much), I got the same error the other day when I tried to load a dll at runtime that was compiled with MSVC while the program doing the loading was compiled with GCC. I just compiled the dll with GCC and all was well.

Share this post


Link to post
Share on other sites
Really.

The dll's I'm using are for sdl, opengl, sdl_net and fmod.....not too sure what they have been built with. And wouldn't know how to recompile as I haven't got access to source...but thanks for the heads up.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement