On Fri, Sep 02, 2011 at 09:56:57PM -0700, Alan Irwin wrote:
> On 2011-09-02 20:49+0100 Andrew Ross wrote:
> 
> > On Tue, Jan 11, 2011 at 09:28:36PM -0800, Alan Irwin wrote:
> >>
> >> This commit finishes what I planned to do for Octave, and I am glad to
> >> say that Andrew has already started making some improvements (i.e.,
> >> handling NULL arguments) to my work.
> >>
> >> Here are some known remaining Octave issues which I am leaving to
> >> Andrew when his time constraints permit some work on these issues.
> >>
> >> 2. Get gcc -fvisibility=hidden option to work.
> >
> > Well I'd entirely forgotten about this
> 
> So had I...  :-)
> 
> > until I tried using it with the
> > Debian packages. A short rummage around in the header files shows that
> > swig defines the function plplot_octave in plplot_octaveOCTAVE_wrap.cxx
> > using the macro DEFUN_DLD, which when you follow it through includes
> > the octave export macro OCTAVE_EXPORT. Unfortunately this only
> > supports the requirements of Windows DLLs and not the gcc visibility,
> > at least in octave-3.2.
> >
> > 1) It would be trivial to patch the octave header
> > /usr/include/octave/oct-dlldefs.h similarly to what we do in pldll.h,
> > but this is an octave bug.
> >
> > 2) Alternatively swig could work around this by prepending SWIG_EXPORT
> > (which is defined correctly) before DEFUN_DLD, but only for the gcc
> > case. This is a bit of a temporary hack.
> >
> > 3) A further alternative is that we modify the swig generated source
> > code to do 2) ourselves.
> >
> > For now, for Debian, I've just disabled -fvisibility=hidden for C++
> > compilers which does the trick, but loses some of the benefits.
> 
> I was going to suggest you try preprocessing tricks, until I realized
> that is probably what you meant by (1) rather than literal patching
> with the patch programme.
> 
> Anyhow, it would be nice to get -fvisibility=hidden working again for
> C++ upstream (and also for your Debian packages) so I suggest you
> choose the easiest of the three alternatives to implement above as a
> "temporary" workaround and also submit a bug report concerning their
> header to octave so that you will be able to remove your temporary
> workaround in the mid term (assuming we keep bumping
> the minimum version of octave we support).

I've played around and it looks like the best thing to do is exactly
the same trick I used to get the matwrapped octave bindings to work
with -fvisibility=hidden, namely to put 

#if defined(__GNUC__) && __GNUC__ > 3
#pragma GCC visibility push(default)
#endif

before the function definition of plplot_octave - the line starting with
DEFUN_DLD in the code

and then

#if defined(__GNUC__) && __GNUC__ > 3
#pragma GCC visibility pop
#endif

after the function definition. I've tested this and it works. This patch 
would best be merged into swig until octave fixes visibility support,
but in the meantime does anyone have an idea what the best way to 
postprocess the swig generated code is in order to do this in plplot?

Andrew


------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to