MapServer / MapServer-import

3 stars 2 forks source link

Java SWIG code compilation problem due to naming convention. #848

Open tbonfort opened 12 years ago

tbonfort commented 12 years ago

Reporter: ykchoo@geozervice.com Date: 2004/09/03 - 09:14

Minor problem found due to naming convention use in Java and methods/struct 
members defined in mapscript.i and header file.

i) For example symbolObj has a member name points and a method getPoints() 
defined. The Java code generated by SWIG contains Java getter/setter for each 
struct defined. Thus, getPoints() are defined "twice" causing compilation 
errors.
Solution: use #ifdef SWIGJAVA to use a diffirent name for the method 
extension, e.g. 
#ifndef SWIGJAVA    
    %newobject getPoints;    
    lineObj *getPoints() {
#else
    %newobject getPoints_;
    lineObj *getPoints_() {
#endif
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/09/03 - 16:09

The solution is to hide the points member from SWIG so that no Java
getter/setter is generated.  All programmers should use the getPoints
and setMethods methods defined in the SWIG module.
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/09/03 - 16:37


#ifndef SWIG
  pointObj points[MS_MAXVECTORPOINTS];
#endif

in both the CVS HEAD and branch-4-2.  

Can I get some confirmation of a fix?
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/09/05 - 18:23

Have committed changes to mapscript.i in branch-4-2 which avoid Java conflicts
for mapObj.clone, symbol.get/setPoints, outputFormatObj.  A patched map.h
and mapscript/mapscript.i are attached.  These will allow you to test the
fix.  Please confirm.
tbonfort commented 12 years ago

Author: ykchoo@geozervice.com Date: 2004/09/06 - 09:07

Patched files 4.2.3-2 works for both C# and Java. Thanks for the quick 
response.
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/09/07 - 15:57

Leave bug resolution to the bug owner.  Thanks for the confirmation!
tbonfort commented 12 years ago

Author: sgillies@frii.com Date: 2004/09/08 - 17:13

closed.