Strange Function Error Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
rangana
Experienced Solver
Experienced Solver
Posts: 53
Joined: Fri Apr 11, 2008 5:48 am
Location: Sri lanka

Strange Function Error

Post by rangana » Wed Jun 17, 2009 9:28 am

Hi Guys,

I am using wxWidgets for my application. I get this random crash (Please see the Attached image) in the application both in debug and release versions.

Any ideas please for this behaviour?
Attachments
crash2.PNG
crash2.PNG (12.13 KiB) Viewed 1178 times
Range

Muetdhiver
Super wx Problem Solver
Super wx Problem Solver
Posts: 323
Joined: Sun Jun 08, 2008 11:59 am
Location: Bordeaux, France

Post by Muetdhiver » Wed Jun 17, 2009 10:00 am

This message speaks by itself. But can you isolate the code that makes the app crash please and post it here ?

Difficult to see without this.
Bye
OS: Ubuntu 11.10
Compiler: g++ 4.6.1 (Eclipse CDT Indigo)
wxWidgets: 2.9.3

TrV
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 630
Joined: Wed Jul 04, 2007 1:12 pm

Post by TrV » Wed Jun 17, 2009 11:17 am

Maybe some unmanaged exception ?

Muetdhiver
Super wx Problem Solver
Super wx Problem Solver
Posts: 323
Joined: Sun Jun 08, 2008 11:59 am
Location: Bordeaux, France

Post by Muetdhiver » Wed Jun 17, 2009 12:24 pm

No.
In fact, I already had this error but I don't remember when and why !!
Maybe it was due to function pointers that were not used as they should do.
For instance, you declare 2 function pointers with two different prototypes, and you want to use one of these two functions but with the pointer that is not the correct one.

That why I want to see the code, maybe I could guess something with it !! :)

Bye !
OS: Ubuntu 11.10
Compiler: g++ 4.6.1 (Eclipse CDT Indigo)
wxWidgets: 2.9.3

Frank
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 211
Joined: Sat Jan 01, 2005 6:19 pm

Post by Frank » Thu Jun 18, 2009 9:49 am

As Muetdhiver said, the error is slef explaining.

Your calling a function with another calling convention then the function is compiled.

Eg. an OPTLINK function with SYSTEM linkage. The calling convention tells the compiler how to remove the parameters from the stack. eg. the function cleans up, like in pascal, or the callsite does it like in c(++). OPTLINK (Or _or fastcall for Visual Studio), uses registers for the parameters where possible, wich is of course much faster than the stack.

It's a compiler switch. In Visual Studio you find it under C++/Advanced. Default ist _cdecl. So when wx is compiled with _cdecl and you project ist compiled with fastcall you crash.

Also it can be a part of the function declaration, if one want to overwrite the default. eg.

int __stdcall myFunc (whatever);

But because those are normally in the header, wich is the same for the function and the caller, your problem lies probable in the project settings.

rangana
Experienced Solver
Experienced Solver
Posts: 53
Joined: Fri Apr 11, 2008 5:48 am
Location: Sri lanka

Worked

Post by rangana » Thu Jun 18, 2009 11:24 am

Thanks Muetdhiver for the advice!

I just went through my method code and found some unusual pointer references. I coded in normal way and error is no more.

Thanks
Range

Post Reply