[Scilab-Dev] Inclusion of scicos_block4.h in external toolboxes source files

Sylvestre Ledru sylvestre.ledru at scilab.org
Mon Apr 6 14:16:57 CEST 2009


I am trying to answer to both your emails since they are similar.

[....]
>    #include "../../includes/foo.h" /* header file inclusion */
>    int csum(double *a, double *b, double *c)
>    {
>      ...
>    }
[....]

In this case, if you add foo.h to the list of the files which must be
compiled, it is going to copy the .h file to TMPDIR too and enable the
capability of using
#include "foo.h"

> 
>   The following is the description of a second little issue I dealt with
> when running the external contribs installation procedure in Scilab-5.x
> (see 
> http://lists.scilab.org/cgi-bin/ezmlm-browse?list=dev&cmd=threadindex&month=200904&threadid=gnflmlndbinnkpmaclij
> if you're interested in the first issue). It occurs both under Windows
> and under GNU/Linux.
> 
>   Let's take a generic toolbox "for Scilab/Scicos", i.e. a toolbox with
> both a Scilab and a Scicos part. It would be good if we could apply the
> standart method described at wiki.scilab.org/howto/Create_a_toolbox in
> this situation as well. As an example, let's suppose that the file
> src/c/csum.c in the toolbox skeleton needs to include the header file
> scicos_block4.h. we could do the following:
> 
>     #include <scicos_block4.h> /* header file inclusion */
>     int csum(double *a, double *b, double *c)
>     {
>       ...
>     }
> 
> In order to be able to build the toolbox, we also need to add to CFLAGS
> the following directory search option:
> 
>     1. -I"$(SCIDIR)\modules\scicos_blocks\includes", in the Windows case
> 
>     or
> 
>     2. -I$(SCIDIR)/../../include/scilab/scicos_blocks/, in the GNU/Linux
>        case.
Yep, it is pretty painful for the toolbox developer.

>   Of course, you could say that is up to toolbox developers to handle
> this issue, by modifying the src builder with a piece of code like
> 
>     if MSDOS then
>         ... 1. ...
>     else
>         ... 2. ...
>     end
> 
>   However, in my opinion, it would be better if Scilab handled the issue
> automatically. 
Yep, we should do something.
However, we cannot add all the include directories in the XXXFLAGS... it
is the same bug problem as in bug #4146 [1].

I had the idea to install all include files into the same directory. 
Unfortunately, it has two issues:
* we have to make sure that here is no two include files with the same
name (it is easy to do)
* This will break toolboxes doing include with relative path like in
your example "../../includes/scicos_block/scicos_block4.h"

Sylvestre
[1] http://bugzilla.scilab.org/show_bug.cgi?id=4146





More information about the dev mailing list