help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Patch for GLPK 4.35 to support SWIG


From: Andrew Makhorin
Subject: Re: [Help-glpk] Patch for GLPK 4.35 to support SWIG
Date: Fri, 30 Jan 2009 18:10:07 +0300

> I am a PhD student studying bioinformatics and I uses GLPK to solve
> linear programming problems that I encounter in my research. I write my
> software in high level languages such as Java or Ruby, and since GLPK is
> written in C, I make calls to GLPK using my language's foreign function
> interface.

> Rather than write an entire foreign function interface for GLPK by
> hand, I use SWIG (http://www.swig.org/) to machine-generate the interface
> for me. Unfortunately, the source for GLPK needs to be (slightly)
> modified for SWIG to process it correctly and generate the interface for
> the target language.

> Until now, I've been maintaining private forks of GLPK and applying
> the changes manually each time I upgrade to a new release. Today, I went
> ahead and packaged them into a patch file so that (hopefully) they can
> make it into the trunk and save me the effort of maintaining my own local
> GLPK copy.

> The patch does two things:
> (1) Adds "glpk.i" to the root of the source tree. This is a SWIG
> interface file that SWIG users can use to generate an interface to GLPK
> in their language of choice.

> (2) Modifies "include/glpk.h" so that SWIG doesn't complain when
> generating the foreign interface. It seems like glpk.h contains some
> redundant lines that can be safely removed without compromising the
> current GLPK build and by removing those lines it also satisfies SWIG's
> demand for a clean C interface file.

> This patch DOESN'T modify the GLPK build to generate any foreign
> language interfaces...that can be left up to GLPK users themselves, since
> it is hard to predict in advance what language support they desire.

> To apply the patch, just place the patchfile in the same directory as
> the directory containing the GLPK 4.35 source code (the directory
> structure should look like the following:)

> /path/to/some/directory:
>   glpk-4.35/
>   swig_support.patch

> Then execute:
> cd /path/to/some/directory/glpk-4.35
> patch -p1 < ../swig_support.patch

> I hope that someone else finds this useful. If it make it into GLPK
> trunk, then at least I would find it useful!

Thank you for your suggestion.

Could you point out a GNU package (library) similar to glpk which
provides swig support? The GNU maintainer documentation says nothing
about such feature.

Is it sufficient to have glpk.h and libglpk to build a wrapper with
swig?

Which lines in glpk.h cause problems? I did not find that in your
patch file.


Andrew Makhorin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]