[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-glpk] glp_scale_prob vs. _glp_scale_prob
From: |
Andrew Makhorin |
Subject: |
Re: [Bug-glpk] glp_scale_prob vs. _glp_scale_prob |
Date: |
Mon, 8 Sep 2008 14:54:17 +0400 |
> in order to get a GLPK 4.31 library linked with other code, I had to
> change line 29 of glpscl.h from
> #define scale_prob _glp_scale_prob
> to
> #define scale_prob glp_scale_prob
> According to glpapi04.c, glp_scale_prob does not have an underscore in
> the beginning.
There are two routines:
1) non-api routine scale_prob (glpscl.c), whose name is changed to
_glp_scale_prob by the preprocessor (glpscl.h) to keep the namespace
clean. It is not defined in glpk.h and should *not* be used in
application programs;
2) api routine glp_scale_prob (glpapi04.c), which calls scale_prob.
The GNU Coding Standards, Section 4.3 "Library Behavior"
<http://www.gnu.org/prep/standards/standards.html#Libraries> say:
Here are certain name conventions for libraries, to avoid name
conflicts.
Choose a name prefix for the library, more than two characters
long. All external function and variable names should start with
this prefix. In addition, there should only be one of these in
any given library member. This usually means putting each one in
a separate source file.
An exception can be made when two external symbols are always
used together, so that no reasonable program could use one
without the other; then they can both go in the same file.
External symbols that are not documented entry points for the
user should have names beginning with _. The _ should be
followed by the chosen name prefix for the library, to prevent
collisions with other libraries. These can go in the same files
with user entry points if you like.
Static functions and variables can be used as you like and need
not fit any naming convention.
The name prefix for glpk is 'glp_', so all external function names,
i.e. names of glpk api routines, start with 'glp_', while all other
non-documented external entry points, i.e. names of non-api routines,
are prefixed with '_glp_'. The only exception is using the prefix
'_glp_lpx_' for some obsolete api routines, which eventually will be
replaced by corresponding 'glp_' equivalents.