Shared library problem 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
Mahr
Experienced Solver
Experienced Solver
Posts: 75
Joined: Fri Aug 26, 2005 10:27 am

Shared library problem

Post by Mahr »

Hi,

I have the following problem. I call in my application a shared library I wrote myself, which is tested to work. I can load this lib also with my wx-app. The problem now is: I use an atof() in my lib, but it won't has any effect! I use wxWidgets2.6.1 in static lib mode, SuSE Linux 9.3.


More strange when I run it with MS Windows it will work.

Has any one any idea what the problem could be?
Damage controll is easy, reading Klingon that's hard
kayaay
Experienced Solver
Experienced Solver
Posts: 65
Joined: Mon Nov 14, 2005 7:21 pm

Post by kayaay »

Sounds like the src string could be double-byte.

atof only works on ANSI strings. You should open the string in question in the memory view of your IDE to verify. It will stop on the first non numerical value it finds including \0

A failure of the function to operate would either be this or else someone redefined atof to do nothing which isn't likely.

If it was a library issue, you'd likely get linker errors. Since you aren't I'd start with what the function is doing at run time.

KA
HeReSY
Earned some good credits
Earned some good credits
Posts: 120
Joined: Fri Sep 17, 2004 8:58 pm
Location: Germany

Post by HeReSY »

You can use the wxString::ToDouble() function to convert your string.

HeReSY
Mahr
Experienced Solver
Experienced Solver
Posts: 75
Joined: Fri Aug 26, 2005 10:27 am

Post by Mahr »

In fact the function which executes the atof doesn't get any data from my wx-app. I read the needed value out of a file. I had similar problems when I was writing in memory not allocated (out of bounds). But I checked my code. I don't think it happen there.
Damage controll is easy, reading Klingon that's hard
Mahr
Experienced Solver
Experienced Solver
Posts: 75
Joined: Fri Aug 26, 2005 10:27 am

Post by Mahr »

I found the solution. I have to set a local variable by using

Code: Select all

setlocal(...);
. It has to do with gtk, that does anything else with this variable ...


Thanks for your help
Damage controll is easy, reading Klingon that's hard
leio
Can't get richer than this
Can't get richer than this
Posts: 802
Joined: Mon Dec 27, 2004 10:46 am
Location: Estonia, Tallinn
Contact:

Post by leio »

Perhaps this should be considered a bug?
Compilers: gcc-3.3.6, gcc-3.4.5, gcc-4.0.2, gcc-4.1.0 and MSVC6
OS's: Gentoo Linux, WinXP; WX: CVS HEAD

Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/
Post Reply