taskGNU Astronomy Utilities - Tasks: task #13786, Usable libraries for other...


You are not allowed to post comments on this tracker with your current authentication level.

task #13786: Usable libraries for other languages (maybe using SWIG)

Submitted by:  Mohammad Akhlaghi <makhlaghi>
Submitted on:  Sat 24 Oct 2015 01:02:20 PM UTC  
Should Start On:  Fri 23 Oct 2015 03:00:00 PM UTC Should be Finished on:  Fri 23 Oct 2015 03:00:00 PM UTC
Category:  Libraries Priority:  7 - High
Item Group:  Enhancement Status:  Postponed
Privacy:  Public Percent Complete:  10%
Assigned to:  None Open/Closed:  Open
Effort:  0.00

Sun 04 Sep 2016 10:32:36 AM UTC, comment #2:

Following the Libtool guidelines, the library header files were corrected to also be usable in C++. The change has been pushed to my personal (development) repository. As you see in the Libtool page, this is much more comprehensive than the suggested addition in the first comment of this task.

A small test C++ program was also added (in `tests/lib/versioncpp.cpp'). It will just do the simplest possible job of printing the version number of Gnuastro, but the important thing is that it is done within C++ which would fail with the headers before this commit.

I tried temporarily renaming the `g++' executable file to see what would happen if we don't have a C++ compiler, but apparently Autoconf is too smart for that and was able to use `gcc' for the C++ compilation. I currently don't have much experience with C++, but if it is possible to only have a C compiler (without C++), then it would be great if we could detect that at configure time and skip this (and possible future) test(s) if the user can't compile C++.

Mohammad Akhlaghi <makhlaghi>
Project Administrator
Thu 26 May 2016 06:15:04 AM UTC, comment #1:

While SWIG is a generic tool, for better preformance and customizability. For the more commonly used languages, it might be better to write the converting files ourselves using Python and NumPy's own low-level C APIs:



Mohammad Akhlaghi <makhlaghi>
Project Administrator
Sat 24 Oct 2015 01:02:20 PM UTC, original submission:

After task #13765 (Convert static libraries to shared libraries) is done, add the proper tools to allow the libraries to be used by other languages.

Most pipelines today use Python and most programmers use C++, being a very low-level tool, Gnuastro should be available to them also, not just C users. So it would be great to allow the users of these (and other languages) also use Gnuastro's libraries.

For C++ it is very streightforward, just add the lines below on the top and bottom of the header files:

#ifdef __cplusplus
extern "C"{

#ifdef __cplusplus

For other languages, SWIG seems to be an interesting solution. From what I understood of SWIG, we can even write a specific Makefile for making shared libraries for any language that it supports. So for example as options to "./configure". The user can run something like "./configure --forpython --forperl". Then the Makefile can run SWIG in the proper way and generate the shared library that can be used in that language. Finally "make install" can install those libraries besides the actual libraries and executable programs so the user can use Gnuastro in what-ever languate they like.

If we have enough interested people to help, we can even write test-suites for these libraries.

Mohammad Akhlaghi <makhlaghi>
Project Administrator


No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by makhlaghi (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-09-04 makhlaghi Percent Complete0% => 10%
    2015-10-24 makhlaghi Item GroupNone => Enhancement
        StatusNone => Postponed

    Back to the top

    Powered by Savane 3.3