using SDL library in Scilab [interfacing]

Remy_Abergel remy.abergel at parisdescartes.fr
Tue Mar 27 12:32:17 CEST 2012


Hello, 

I'm trying to create a new *Image Processing Toolbox* for Scilab.
I could implement successfully basics functions (displaying grayscaled image
on the screen, zooming using the mouse left double click, showing pixels
coordinates and values using mouse left-click, ...) using Scilab graphic
objects (figures) and Matplot.

This is efficient, but not fully satisfying me. That is why I would like to
re-write the main display functions in *C-code with SDL library*. I would
then interface the code with Scilab.

As a first try, I would like *to draw a SDL window on the screen*. For that
I use the following code:

void show_win()
{
    SDL_Init(SDL_INIT_VIDEO); // SDL initialisation
    SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE); 
    pause();
    SDL_Quit(); // quit SDL
}

void pause() //wait until the window is closed
{
	int cont = 1;
	SDL_Event event;
   while (cont){
		SDL_WaitEvent(&event);
		switch(event.type){
			case SDL_QUIT:
			cont = 0;
		}
	}
}



And here is the interface that I wrote (in the same file as functions
"pause" and "show_win"):

int interface_show_win(char *fname)
{
  int minlhs=0, maxlhs=0, minrhs=0, maxrhs=0;
  CheckRhs(minrhs,maxrhs) ;
  CheckLhs(minlhs,maxlhs) ;
  show_window();
  return 0;
}


the include files are the following:

#include <stdlib.h>
#include <stdio.h>
#include "stack-c.h"
#include <SDL/SDL.h>


and here is the builder.sce file content:

ilib_name  = 'lib_show_win'	// interface library name 
files = ['interface_show_win.o'];
libs  = [] 		// other libs needed for linking
table =['show_win', 'interface_show_win'];
ilib_build(ilib_name,table,files,libs)


when I type in Scilab: exec builder.sce
the loader.sce file is sucessfuly created.

But when I type in Scilab: exec builder.sce
*I get the following error*:


-->addinter(lib_show_win_path+'/lib_show_win.so','lib_show_win',list_functions);
Link failed for dynamic library
'/home/remy/Workspaces/Scilab/interface/window//lib_show_win.so'.
An error occurred:
/home/remy/Workspaces/Scilab/interface/window//lib_show_win.so: undefined
symbol: SDL_WaitEvent
Link failed for dynamic library
'/home/remy/Workspaces/Scilab/interface/window//lib_show_win.so'.
An error occurred:
/home/remy/Workspaces/Scilab/interface/window//lib_show_win.so: undefined
symbol: SDL_WaitEvent
addinter(lib_show_win_path+'/lib_show_win.so','lib_show_win',list_functions);
                                                                            
!--error 236 
addinter: The shared archive was not loaded: (null)
at line       7 of exec file called by :    
exec loader.sce
 
 

I guess this is due to a bad linking of SDL library. It remains a little bit
confuse for me, but I tryied to change the libs'var in builder.sce, trying
successively: 

libs  = ['SDL'] 		// other libs needed for linking 
libs  = ['libSDL'] 		// other libs needed for linking 
libs  = ['lSDL'] 		// other libs needed for linking 
libs  = ['SDLmain'] 		// other libs needed for linking 

It still doesn't work. If you know what is wrong, please let me know.

Best Regards, 

R. Abergel

--
View this message in context: http://mailinglists.scilab.org/using-SDL-library-in-Scilab-interfacing-tp3860938p3860938.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.



More information about the users mailing list