[Scilab-users] Creating shared objects, using slepc, to work with scilab
kichun
kichun1 at gmail.com
Sun Sep 2 18:50:43 CEST 2012
Dear all,
I am using scilab on ubuntu, and now I'm strugling to make use of SLEPc
(http://www.grycap.upv.es/slepc/) in scilab. I did manage to compile some
simple codec in c into shared objects and then succesfully link them to
scilab, but in this case it is more complicated. To compile ***.c files,
which refer to SLEPc library I have to (accordingly to official SLEPc
website) make a simple makefile, like this:
hello: hello.o chkopts
-${CLINKER} -o hello hello.o ${SLEPC_LIB}
${RM} hello.o
include ${SLEPC_DIR}/conf/slepc_common
where hello.c is:
static char help[] = "Simple Hello World example program in SLEPc\n";
#include "slepceps.h"
#undef __FUNCT__
#define __FUNCT__ "main"
int main( int argc, char **argv )
{
int ierr;
SlepcInitialize(&argc,&argv,(char*)0,help);
ierr = PetscPrintf(PETSC_COMM_WORLD,"Hello world\n");CHKERRQ(ierr);
ierr = SlepcFinalize();CHKERRQ(ierr);
return 0;
}
and this basically works. I also tried more complex codes, and they compile
and execute as well.
Now I would like to write a function using SLEPc, that could be called from
Scilab. At first, the simpliest possible is enough, so i changed the hello.c
and the makefile:
hello: hello.o chkopts
gcc -shared -fPIC -o hello.so ${SLEPC_LIB}
include ${SLEPC_DIR}/conf/slepc_common
hello.c:
static char help[] = "Simple Hello World example program in SLEPc\n";
#include "slepceps.h"
void hello( int n)
{
int ierr;
int i;
int **argc;
char **argv;
char dupa;
i=0;
argc=i;
dupa=' ';
argv=dupa;
SlepcInitialize(&argc,&argv,(char*)0,help);
for(i=0;i<n;i++){
ierr = PetscPrintf(PETSC_COMM_WORLD,"Hello world\n");CHKERRQ(ierr);
}
ierr = SlepcFinalize();CHKERRQ(ierr);
}
and that runs well (i mean "make hello"), but Scilab can't link it. After
running "link('./hello.so','hello','c')" I get:
Shared archive loaded.
Link done.
hello is not an entry point.
!--error 235
link: problem with one of the entry point.
and i have no idea what to do:(
Please help me if you can, this is very important for me!
Cheers,
Michael
--
View this message in context: http://mailinglists.scilab.org/Creating-shared-objects-using-slepc-to-work-with-scilab-tp4024773.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
More information about the users
mailing list