Linking a .mexglx, say pipo.mexglx, file with Scilab.
(Assuming pipo.mexglx has been created by the Matlab's mex script).
1/ If necessary, create empty libmx.so libmex.so and libmat.so which 
could be required by the .mexglx file.
(If "ldd pipo.mexglx" shows a dependency). 

This is done by the following commands:
****
-->ilib_for_link("mx",[],[],"c");
-->ilib_for_link("mex",[],[],"c");
-->ilib_for_link("mat",[],[],"c");
****

2/link the (almost empty) .so files with Scilab
-->link ./libmx.so;
-->link ./libmex.so;
-->link ./libmat.so;

3/link pipo.mexglx with Scilab
-->link ./pipo.mexglx;

4/ Make a dynamic library with the following C routine (libtst.c file).
Note that the entrypoint MUST BE mexFunction
****************libtst.c*********************
#include <mex.h>
extern Gatefunc mexFunction;
static GenericTable Tab[]={
  {mex_gateway,mexFunction,"errmsg"},
};
 
int C2F(libtst)()
{
  Rhs = Max(0, Rhs);
  (*(Tab[Fin-1].f))(Tab[Fin-1].name,Tab[Fin-1].F);
  return 0;
}

This is done by the following script "Makelib"
make -f Makelib
************Makelib**************************
SCIDIR = /to/be/filled/scilab/path
OBJS =  libtst.o 
LIBRARY = libtst.a
include $(SCIDIR)/Makefile.incl
CFLAGS = $(CC_OPTIONS) 
EXTRA_LDFLAGS = 
include $(SCIDIR)/config/Makeso.incl
*********************************************

5/At Scilab prompt enter:
-->addinter('./libtst.so','libtst','pipo');
OR addinter ./libtst.so libtst pipo to link libtst.so with Scilab.
Note that pipo is the name of the Scilab function.

6/call the mexfunction:
-->pipo(...)
Note that the mexfunction is called through the libtst function
using the entrypoint 'libtst' (not mexFunction!).
If several mexFunction are used, one should build several 
libtst.c file, one for each mexfunction, using a different name
e.g. libtst1.c libtst2.c ... Each mexFunction must be called through a
different entrypoint. 

Here Makelib and libtst.c are generic files while
Makextimesy and libxtimesy.c are adapted to xtimesy.mexglx.

*********************************************
OR ...
ld -shared -o pipo.so libtst.so pipo.mexglx -rpath `pwd`
addinter('./pipo.so','libtst','pipo');

EXAMPLE:
mexname='xtimesy';
mputl(strsubst(mgetl('libtst.c'),'libtst',mexname),'lib'+mexname+'.c');
mputl(strsubst(mgetl('Makelib'),'libtst','lib'+mexname),'Make'+mexname);
//make -f Makextimesy
// ld -shared -o xtimesy.so libxtimesy.o xtimesy.mexglx -rpath `pwd`
//OR :
link ./libmx.so;
link ./libmex.so;
link ./libmat.so;
link ./xtimesy.mexglx;
addinter('./libxtimesy.so','xtimesy','xtimesy')
xtimesy(2,3)
