On Mon, Jan 02, 2012 at 08:35:49PM +0100, Arjen Markus wrote:
> Hello everyone,
> 
> I have been trying to help Walter get started with PLplot 
> on Windows and
> though he has succeeded in this, in the process we came 
> across a peculiar
> problem with the PL_DEPRECATED flag and C++.
> 
> If I turn it on on Windows XP and use gcc to compile it 
> all, then this
> is the result:
> 
> Linking CXX executable x08.exe
> CMakeFiles\x08.dir/objects.a(x08.cc.obj):x08.cc:(.text+0x30b): 
> undefined reference to 
> `_imp___ZN8plstream11Alloc2dGridEPPPdii'
> CMakeFiles\x08.dir/objects.a(x08.cc.obj):x08.cc:(.text+0xb44): 
> undefined reference to 
> `_imp___ZN8plstream10Free2dGridEPPdii'
> collect2: ld returned 1 exit status
> make[2]: *** [examples/c++/x08.exe] Error 1
> make[1]: *** [examples/c++/CMakeFiles/x08.dir/all] Error 2
> make: *** [all] Error 2
> 
> Apparently the definition of the preprocessor symbols that 
> occurs with PL_DEPRECATED
> defined confuses the actual use in example x08.cc (and 
> possibly others), but I do
> not see what I can do about it. I thought an examination 
> of the preprocessed source
> would make it clear, but alas, it does not.
> 
> Other functions that I know caused trouble: plhls and 
> plrgb.
> 
> Can someone with a better understanding of C++ have a look 
> at this?

Arjen,

Good spot! I can reproduce the problem on Linux as well. Looking at the 
output of objdump it turns out the problem is the backward compatibility
macros for Alloc2dGrid, Free2dGrid and MinMax2dGrid in include/plplot.h.
Since the C++ class uses the plplot function names without the pl
prefix (it's not needed as the functions are in the namespace of the
class anyway), these macros mess up the C++ functions for these 
functions. I've committed a fix which just comments out these macros. 
They are only for backwards compatibility and these old versions haven't
been used in the examples for a long time. If anyone shouts, I'll try 
a more complicated fix to check whether plplot.h is being included from
plstream.h, but I don't think this is very robust. Given no-one has 
complained (or even noticed) this bug for months I suspect it is not
a problem.

Andrew

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to