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: Kelly Westbrooks
Subject: Re: [Help-glpk] Patch for GLPK 4.35 to support SWIG
Date: Fri, 30 Jan 2009 08:43:45 -0800 (PST)

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

Actually, I can't provide you an example. Math::GSL is a SWIG-generated Perl 
interface to the GSL library, but it looks like its maintained in a separate 
repository.

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

I haven't tried, but i'm fairly sure it's possible. It would burden the user 
with having to deploy 2 libraries (libglpk and the wrapper library) instead of 
one, which might be undesirable for some people. But then, there are good 
arguments for keeping them separate as well.

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

Lines 152-156:

#define GLP_MSG_OFF        0  /* no output */
#define GLP_MSG_ERR        1  /* warning and error messages only */
#define GLP_MSG_ON         2  /* normal output */
#define GLP_MSG_ALL        3  /* full output */
#define GLP_MSG_DBG        4  /* debug output */

These lines are redundant (they are identical to lines 115-119) and i'm pretty 
sure they can be safely removed without breaking anything. When you try to run 
SWIG against glpk.h, SWIG complains about these lines.

I can appreciate you hesitation about including the SWIG interface file in the 
GLPK source tree - it would be one more thing to maintain and it is peripheral 
to the fundamental purpose of the library. I know that i'm not the first person 
that has had a desire use GLPK from a language other than C - in fact, I stole 
the interface file from here:
http://www.nabble.com/Re:-GLPK-and-Java-using-SWIG-tc10910553.html
and made a few changes to it to suit my own tastes.

I guess that i'm suggesting that by including the glpk.i interface file in the 
GLPK source tree, it might encourage others to use the SWIG-generated wrappers 
as a foundation for writing clean interfaces to GLPK in other languages. As it 
currently stands, someone that wants to do this has to jump through a few hoops 
(write the SWIG interface file glpk.i, make changes to glpk.h, etc).

--Kelly


      




reply via email to

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