Added John's perl5 patches
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4310 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
567394c2a8
commit
08c3b43b24
8 changed files with 116 additions and 9 deletions
|
|
@ -1,5 +1,11 @@
|
|||
Version 1.3.18 (In progress)
|
||||
============================
|
||||
02/13/2003: lenz
|
||||
Updated Doc/Manual/Perl5.html to talk about C++ compile problems
|
||||
configure.in now checks for PERL5_CCFLAGS
|
||||
Runtime/Makefile.in and Example/Makefile.in now use PERL5_CCFLAGS
|
||||
Added Lib/perl5/noembed.h which contains all the known macro conflicts
|
||||
|
||||
02/12/2003: beazley
|
||||
Fixed [ 685410 ] C++ Explicit template instantiation causes SWIG to exit.
|
||||
Fixes a syntax error with declarations similar to this:
|
||||
|
|
|
|||
|
|
@ -431,6 +431,24 @@ Solaris, you often need to add an extra library <tt>-lCrun</tt> like this:
|
|||
Of course, the names of the extra libraries are completely non-portable---you will
|
||||
probably need to do some experimentation.
|
||||
|
||||
<p>
|
||||
Another possible compile problem comes from recent versions of Perl (5.8.0) and the GNU tools.
|
||||
If you see errors having to do with _crypt_struct, that means _GNU_SOURCE is not defined and
|
||||
it needs to be. So you should compile the wrapper like:
|
||||
|
||||
<blockquote><pre>
|
||||
% g++ -c example_wrap.cxx -I/usr/lib/perl/5.8.0/CORE -D_GNU_SOURCE
|
||||
</pre></blockquote>
|
||||
|
||||
-D_GNU_SOURCE is also included in the Perl ccflags, which can be found by running
|
||||
<blockquote><pre>
|
||||
% perl -e 'use Config; print $Config{ccflags};'
|
||||
</pre></blockquote>
|
||||
So you could also compile the wrapper like
|
||||
<blockquote><pre>
|
||||
% g++ -c example_wrap.cxx -I/usr/lib/perl/5.8.0/CORE `perl -e 'use Config; print $Config{ccflags}'`
|
||||
</pre></blockquote>
|
||||
|
||||
<p>
|
||||
Sometimes people have suggested that it is necessary to relink the
|
||||
Perl interpreter using the C++ compiler to make C++ extension modules work.
|
||||
|
|
@ -472,7 +490,7 @@ erratic program behavior. Also, be aware that certain C++ features, especially
|
|||
can behave strangely when working with multiple modules.
|
||||
|
||||
<p>
|
||||
Finally, it should be noted that you may get alot of error messages
|
||||
It should be noted that you may get alot of error messages
|
||||
about the `<tt>bool</tt>' datatype when compiling a C++ Perl module. If
|
||||
you experience this problem, you can try the following :<p>
|
||||
|
||||
|
|
@ -482,6 +500,26 @@ you experience this problem, you can try the following :<p>
|
|||
<li>Or use <tt>-Dbool=char</tt> when compiling.
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
Finally, recent versions of Perl (5.8.0) have namespace conflict problems. Perl defines a bunch
|
||||
of short macros to make the Perl API function names shorter. For example, in
|
||||
/usr/lib/perl/5.8.0/CORE/embed.h there is a line:
|
||||
|
||||
<blockquote><pre>
|
||||
#define do_open Perl_do_open
|
||||
</pre></blockquote>
|
||||
|
||||
The problem is, in the <iostream> header from GNU libstdc++v3 there is a private
|
||||
function named do_open. If <iostream> is included after the perl headers, then
|
||||
the Perl macro causes the iostream do_open to be renamed, which causes compile errors.
|
||||
Hopefully in the future Perl will support a PERL_NO_SHORT_NAMES flag, but for now the
|
||||
only solution is to undef the macros that conflict. Lib/perl5/noembed.h in the SWIG
|
||||
source has a list of macros that are known to conflict with either standard headers or
|
||||
other headers. But if you get macro type conflicts from other macros not included
|
||||
in Lib/perl5/noembed.h while compiling the wrapper, you will
|
||||
have to find the macro that conflicts and add an #undef into the .i file. Please report
|
||||
any conflicting macros you find to <a href="mailto:swig@cs.uchicago.edu">swig@cs.uchicago.edu</a>.
|
||||
|
||||
<a name="n10"></a><H3>17.2.7 Compiling for 64-bit platforms</H3>
|
||||
|
||||
|
||||
|
|
@ -2460,6 +2498,6 @@ not even sure if it really works). <p>
|
|||
|
||||
<p><hr>
|
||||
|
||||
<address>SWIG 1.3 - Last Modified : June 2, 2002</address>
|
||||
<address>SWIG 1.3 - Last Modified : Feb 13, 2003</address>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -178,13 +178,15 @@ PERL5_INCLUDE= @PERL5EXT@
|
|||
# Extra Perl specific dynamic linking options
|
||||
PERL5_DLNK = @PERL5DYNAMICLINKING@
|
||||
|
||||
PERL5_CCFLAGS = @PERL5CCFLAGS@
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# Build a Perl5 dynamically loadable module (C)
|
||||
# ----------------------------------------------------------------
|
||||
|
||||
perl5: $(SRCS)
|
||||
$(SWIG) -perl5 $(SWIGOPT) $(INTERFACE)
|
||||
$(CC) -c -Dbool=char $(CCSHARED) $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) -I$(PERL5_INCLUDE)
|
||||
$(CC) -c -Dbool=char $(CCSHARED) $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) $(PERL5_CCFLAGS) -I$(PERL5_INCLUDE)
|
||||
$(LDSHARED) $(OBJS) $(IOBJS) $(PERL5_DLNK) $(LIBS) -o $(TARGET)$(SO)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
|
@ -193,7 +195,7 @@ perl5: $(SRCS)
|
|||
|
||||
perl5_cpp: $(SRCS)
|
||||
$(SWIG) -perl5 -c++ $(SWIGOPT) $(INTERFACE)
|
||||
$(CXX) -c $(CCSHARED) $(CFLAGS) -Dexplicit= $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) -I$(PERL5_INCLUDE)
|
||||
$(CXX) -c $(CCSHARED) $(CFLAGS) -Dexplicit= $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PERL5_CCFLAGS) -I$(PERL5_INCLUDE)
|
||||
$(CXXSHARED) $(OBJS) $(IOBJS) $(PERL5_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(TARGET)$(SO)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
|
@ -204,12 +206,12 @@ PERL5_RUNTIME=-L$(RUNTIMEDIR) -lswigpl@release_suffix@
|
|||
|
||||
perl5_multi: $(SRCS)
|
||||
$(SWIG) -c -perl5 $(SWIGOPT) $(INTERFACE)
|
||||
$(CC) -c -Dbool=char $(CCSHARED) $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) -I$(PERL5_INCLUDE)
|
||||
$(CC) -c -Dbool=char $(CCSHARED) $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) $(PERL5_CCFLAGS) -I$(PERL5_INCLUDE)
|
||||
$(LDSHARED) $(OBJS) $(IOBJS) $(PERL5_RUNTIME) $(PERL5_DLNK) $(LIBS) -o $(TARGET)$(SO)
|
||||
|
||||
perl5_multi_cpp: $(SRCS)
|
||||
$(SWIG) -c -perl5 -c++ $(SWIGOPT) $(INTERFACE)
|
||||
$(CXX) -c $(CCSHARED) $(CFLAGS) -Dexplicit= $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) -I$(PERL5_INCLUDE)
|
||||
$(CXX) -c $(CCSHARED) $(CFLAGS) -Dexplicit= $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PERL5_CCFLAGS) -I$(PERL5_INCLUDE)
|
||||
$(CXXSHARED) $(OBJS) $(IOBJS) $(PERL5_RUNTIME) $(PERL5_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(TARGET)$(SO)
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
# see top-level Makefile.in
|
||||
Makefile.pl
|
||||
Makefile.pl noembed.h
|
||||
|
|
|
|||
51
Lib/perl5/noembed.h
Normal file
51
Lib/perl5/noembed.h
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#ifdef do_open
|
||||
#undef do_open
|
||||
#endif
|
||||
#ifdef do_close
|
||||
#undef do_close
|
||||
#endif
|
||||
#ifdef scalar
|
||||
#undef scalar
|
||||
#endif
|
||||
#ifdef list
|
||||
#undef list
|
||||
#endif
|
||||
#ifdef apply
|
||||
#undef apply
|
||||
#endif
|
||||
#ifdef convert
|
||||
#undef convert
|
||||
#endif
|
||||
#ifdef Error
|
||||
#undef Error
|
||||
#endif
|
||||
#ifdef form
|
||||
#undef form
|
||||
#endif
|
||||
#ifdef vform
|
||||
#undef vform
|
||||
#endif
|
||||
#ifdef LABEL
|
||||
#undef LABEL
|
||||
#endif
|
||||
#ifdef METHOD
|
||||
#undef METHOD
|
||||
#endif
|
||||
#ifdef Move
|
||||
#undef Move
|
||||
#endif
|
||||
#ifdef yylex
|
||||
#undef yylex
|
||||
#endif
|
||||
#ifdef yyparse
|
||||
#undef yyparse
|
||||
#endif
|
||||
#ifdef yyerror
|
||||
#undef yyerror
|
||||
#endif
|
||||
#ifdef invert
|
||||
#undef invert
|
||||
#endif
|
||||
#ifdef ref
|
||||
#undef ref
|
||||
#endif
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
%runtime "common.swg" // common type checking code
|
||||
%runtime "perlrun.swg" // Perl runtime functions
|
||||
%runtime "noembed.h" // undefine Perl5 macros
|
||||
|
||||
/* Typemaps for input parameters */
|
||||
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ libswigpy$(RELEASESUFFIX).la:
|
|||
|
||||
PERL5_INCLUDE = -I@PERL5EXT@
|
||||
PERL5_RUNTIME = $(SWIGLIB)/perl5/perlrun.swg
|
||||
PERL5_CCFLAGS = @PERL5CCFLAGS@
|
||||
|
||||
# Perl shared
|
||||
|
||||
|
|
@ -110,7 +111,7 @@ libswigpl$(RELEASESUFFIX).la: $(srcdir)/$(SWIG_TYPECHECK) $(srcdir)/$(PERL5_RUNT
|
|||
@rm -f libperl.c
|
||||
# cat $(srcdir)/perlrun.h >> libperl.c
|
||||
cat $(srcdir)/$(SWIG_TYPECHECK) $(srcdir)/$(PERL5_RUNTIME) >> libperl.c
|
||||
$(LIBTOOL) $(CC) -c $(PERL5_INCLUDE) -DSWIG_GLOBAL -Dbool=char -Dexplicit= libperl.c
|
||||
$(LIBTOOL) $(CC) -c $(PERL5_INCLUDE) -DSWIG_GLOBAL -Dbool=char -Dexplicit= $(PERL5_CCFLAGS) libperl.c
|
||||
$(LIBTOOL) $(CC) -o libswigpl$(RELEASESUFFIX).la libperl.lo -rpath $(LIB_DIR) -avoid-version
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -588,6 +588,13 @@ if test -n "$PERL"; then
|
|||
else
|
||||
AC_MSG_RESULT($PERL5LIB)
|
||||
fi
|
||||
AC_MSG_CHECKING(for Perl5 compiler options)
|
||||
PERL5CCFLAGS=`($PERL -e 'use Config; print $Config{ccflags}') 2>/dev/null`
|
||||
if test "$PERL5CCFLAGS" = "" ; then
|
||||
AC_MSG_RESULT(not found)
|
||||
else
|
||||
AC_MSG_RESULT($PERL5CCFLAGS)
|
||||
fi
|
||||
else
|
||||
AC_MSG_RESULT(unable to determine perl5 configuration)
|
||||
PERL5EXT=$PERL5DIR
|
||||
|
|
@ -606,6 +613,7 @@ esac
|
|||
AC_SUBST(PERL5EXT)
|
||||
AC_SUBST(PERL5DYNAMICLINKING)
|
||||
AC_SUBST(PERL5LIB)
|
||||
AC_SUBST(PERL5CCFLAGS)
|
||||
|
||||
# kludges to ease naming conventions conformance.
|
||||
( cd Examples ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue