Error parsing mapfile with floats using csharp/MONO/Linux

Szekeres Tamás szekeres.tamas at FREEMAIL.HU
Wed Apr 26 18:18:17 EDT 2006


I have recently added a simple make test functionality for
the linux csharp build. The test simply runs the sample
applications compiled along with mapscript.

the drawmap sample fails with the following error:

Unhandled Exception: System.ApplicationException:
loadMapInternal(): General
error message. Given map extent <-0,000000, 50,000000,
0,000000, 51,000000> is
invalid. Check that it is in the form: minx, miny, maxx, maxy
in <0x0003d> mapObj:.ctor (System.String filename)
in <0x00056> DrawMap:Main (System.String[] args)
make: *** [test] Error 1

The problem occurs when parsing the EXTENT parameter in the
map file and the
atof() function truncates the float values to integers.
I have modified mapfile.c to print the EXTENT values parsed:

mono ./drawmap.exe ../../tests/ test_csharp.png
msyytext= -0.5 msyynumber= -0,000000, atof(msyytext)= -0,000000 
strtod(msyytext)= -0,000000
msyytext= 50.977222 msyynumber= 50,000000, atof(msyytext)=
strtod(msyytext)= 50,000000
msyytext= 0.5 msyynumber= 0,000000, atof(msyytext)= 0,000000
msyytext= 51.977222 msyynumber= 51,000000, atof(msyytext)=
strtod(msyytext)= 51,000000

I have implemented the same functionality inside
mapscript_wrap.c and when compiling without -shared and
running the application directly works well. But compiling
as shared and invoking the same function from csharp the
problem appears.

The compilation method is almost the same like java but it
does not suffer with this issue.

I guess that wrong libstdc++ usage may be reasponsible for
this behaviour. But at this point I have stucked.

Could anyone point me to the right direction to fix this


to track this bug.


Tamas Szekeres

Digitális képből papírkép már 25 Ft-tól! Ingyenes budapesti házhozszállítás! >>>

More information about the mapserver-dev mailing list