[Mapserver-users] Python mapscript - I fixed it!

Vic Kelson vic at wittmanhydro.com
Mon Jun 16 10:10:55 EDT 2003


This is a multi-part message in MIME format.
--------------060209030000000605090909
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hooray!

At Long Last, I have succeeded in making mapscript with python compile, 
for mapserver-4.0b. I finally found the error, which is in 'pymodule.i'. 
Here it is...

The function  _raise_ms_exception() begins with the following code:

static void _raise_ms_exception(void) {
        char errbuf[256];
        char errmsg[2048]; // room for up to 8 * 256 byte messages
        int errcode;

        strcpy(errmsg, "");
        errorObj *ms_error = msGetErrorObj();
        errcode = ms_error->code;

The highlighted line is valid C++, but is not valid C (at least it 
wasn't valid in my olden days as a C programmer, or according to 
gcc-2.95). I have repaired this by separating the declaration and 
assignment:

static void _raise_ms_exception(void) {
        char errbuf[256];
        char errmsg[2048]; // room for up to 8 * 256 byte messages
        int errcode;
        errorObj *ms_error;

        strcpy(errmsg, "");
        ms_error = msGetErrorObj();
        errcode = ms_error->code;

and now it all compiles successfully on RedHat 7.3 and Debian (woody). I 
also had to mangle setup.py to make it work on my system. I'll send my 
changes to Sean Gillies, who has helped me out with this mess.

THANKS for the help, folks!
Vic



--------------060209030000000605090909
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
  <title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Hooray!<br>
<br>
At Long Last, I have succeeded in making mapscript with python compile,
for mapserver-4.0b. I finally found the error, which is in
'pymodule.i'. Here it is...<br>
<br>
The function&nbsp; _raise_ms_exception() begins with the following code:<br>
<br>
<tt>static void _raise_ms_exception(void) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char errbuf[256];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char errmsg[2048]; // room for up to 8 * 256 byte messages<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int errcode;<br>
<br>
<font color="#ff0000"></font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcpy(errmsg, "");<br>
</tt><tt><font color="#ff0000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; errorObj *ms_error</font></tt><tt><font
 color="#ff0000"> = msGetErrorObj();</font><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; errcode = ms_error-&gt;code;<br>
<br>
</tt>The highlighted line is valid C++, but is not valid C (at least it
wasn't valid in my olden days as a C programmer, or according to
gcc-2.95). I have repaired this by separating the declaration and
assignment:<br>
<tt><br>
static void _raise_ms_exception(void) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char errbuf[256];<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char errmsg[2048]; // room for up to 8 * 256 byte messages<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int errcode;<br>
<font color="#ff0000"><font color="#000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; errorObj *ms_error;<br>
</font><br>
</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strcpy(errmsg, "");<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ms_error = msGetErrorObj();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; errcode = ms_error-&gt;code;<br>
</tt><br>
and now it all compiles successfully on RedHat 7.3 and Debian (woody).
I also had to mangle setup.py to make it work on my system. I'll send
my changes to Sean Gillies, who has helped me out with this mess.<br>
<br>
THANKS for the help, folks!<br>
Vic<br>
<br>
<br>
</body>
</html>

--------------060209030000000605090909--




More information about the mapserver-users mailing list