Recently in swig Category

Inside Look of Math::GSL

| | Comments (0) | TrackBacks (0)
Here is a breakdown of how many lines of code (roughly) are in different languages in the Math::GSL codebase:

  • 280889 lines - XS ( C-like Perl internals autogenerated by SWIG)
  • 60181 lines  - Total Perl (generated by SWIG)
  •  22941  lines- Hand-written Perl 
    •  8617 lines - Tests
    • 13731 lines - POD (this actually includes some Perl implementation, probably <5%). Much of this was autogenerated from the GSL C documentation and reformatted, but it stills needs work, especially in making the POD render to HTML in a more pleasant way.
  • 1112   lines - SWIG
The reason why Math::GSL requires something like SWIG becomes very apparent. The SWIG interface files are roughly 1/280th the length of the raw XS source code. No reasonable  person would be hacking on Perl internals, but not even a reasonable Perl hacker wants to write all that error checking boilerplate cruft. Thanks SWIG!

This was made possible by ripping all Perl code out of the SWIG interface files and putting them in the pod/ directory. It is not strictly POD but a simple naming scheme was key and the majority of the files do happen to be POD, so whatev. And now vim correctly syntax highlights the files! I think there is something to be said for sticking to one language per file. 

Perl 5.8.8 compile issues with SWIG

| | Comments (0) | TrackBacks (0)

I just installed a fresh Ubuntu 8.04 system, which comes with Perl 5.8.8 by default. Using gcc 4.2.3/swig 1.3.33 I get the following build failure:


gcc -I/usr/lib/perl/5.8/CORE -c -shared -Wall -fpic -Dbool=char -I/usr/local/include/ -Wno-strict-aliasing -Wno-unused-function -Wno-unused-value -Wno-unused-function -Wno-unused-variable -o BLAS_wrap.so BLAS_wrap.c
In file included from /usr/lib/perl/5.8/CORE/op.h:497,
                 from /usr/lib/perl/5.8/CORE/perl.h:2754,
                 from BLAS_wrap.c:709:
/usr/lib/perl/5.8/CORE/reentr.h:612: error: field '_crypt_struct' has incomplete type
In file included from /usr/lib/perl/5.8/CORE/perl.h:3950,
                 from BLAS_wrap.c:709:
/usr/lib/perl/5.8/CORE/proto.h:297: error: expected declaration specifiers or '...' before 'off64_t'
/usr/lib/perl/5.8/CORE/proto.h:299: error: expected '=', ',', ';', 'asm' or 'attribute' before 'Perl_do_sysseek'
/usr/lib/perl/5.8/CORE/proto.h:300: error: expected '=', ',', ';', 'asm' or 'attribute' before 'Perl_do_tell'
/usr/lib/perl/5.8/CORE/proto.h:2004: error: expected '=', ',', ';', 'asm' or 'attribute' before 'Perl_PerlIO_tell'
/usr/lib/perl/5.8/CORE/proto.h:2005: error: expected declaration specifiers or '...' before 'off64_t'
Use of uninitialized value in concatenation (.) or string at /home/leto/git/Math-GSL/_build/lib/MyModuleBuilder.pm line 173.
error building  file from 'BLAS_wrap.c' at /home/leto/git/Math-GSL/_build/lib/MyModuleBuilder.pm line 173.


But with Perl 5.10.0 it builds fine, any ideas?

Strange crash resolved

| | Comments (0) | TrackBacks (0)
Evidently, this typemap was causing the issue with gcc 4.x:


 %typemap(freearg) double const [] {
    free($1);
}


What made it hard to track down was that I could not reproduce it on gcc 3.4.6. It was cargo-culted and unnecessary code. Have we learned our lesson?

About this Archive

This page is a archive of recent entries in the swig category.

release is the previous category.

update is the next category.

Find recent content on the main index or look in the archives to find all content.

Screw you, spammers! Clicky Web Analytics