using SDL library in Scilab [interfacing]

Remy_Abergel remy.abergel at parisdescartes.fr
Tue Mar 27 14:30:32 CEST 2012


Dear Allan,

Thank you for your quick and efficient answer. link('libSDL.so') returned an
error, I realized that the file was protected.
I made a chmod a+rwx on it, now it works.

I have now 1 question and 1 problem:

*Question*:

Because I can do chmod only on my own computer, I think I would be oblige to
include a copy of the libSDL.so in my future toolbox right? Does it raise
any portability issue? (for example if the real libSDL.so file is changed by
SDL developers)


*Problem*:   

I may be wrong but it seems that a function with no output can not be
interfaced with Scilab. Indeed, when I called my function (typing show_win()
in Scilab console) I had an error message:

   show_win: Wrong number of output  argument(s): 0 expected

So I simply added a useless output argument to my function. Now it works, a
graphic window is opened when I call my function. *But when I close the
window, Scilab closes...* 

You will find below the code, but I tested it with my IDE (CodeBlocks) it
works perfectly... 
A "hs_err_pid22814.log" file has been created in the same repertory as the
builder.sce file, it says that:

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x067ff7ee, pid=22814, tid=3078818016
#
# JRE version: 6.0_20-b20
# Java VM: OpenJDK Server VM (19.0-b09 mixed mode linux-x86 )
# Derivative: IcedTea6 1.9.13
# Distribution: Ubuntu 10.04.1 LTS, package 6b20-1.9.13-0ubuntu1~10.04.1
# Problematic frame:
# C  [lib_show_win.so+0x7ee]  show_win+0x5e
#
... 

*Do you have any idea how to fix it?*


About your remark about SIP/SIVP:
I am working for SIMILAN project, initiated by Thales, in association with
Scilab, dxo, Map5 (Parsi Descartes University), amongst others. For the
moment, I am trying to implement a version of MegaWave into Scilab.

You will find below the sources of the code. Thank you very much for your
support.

Regards, 

Rémy Abergel.



souces:

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

void show_win(int *output)
{
   SDL_Init(SDL_INIT_VIDEO); // SDL initialisation
   SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE); 

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

   SDL_Quit(); // quit SDL
   *output = 1;
}

int interface_show_win(char *fname)
{
  int opt_m1=1, opt_n1=1, opt_l1;
  int minlhs=1, maxlhs=1, minrhs=0, maxrhs=0;
  CheckRhs(minrhs,maxrhs) ;
  CheckLhs(minlhs,maxlhs) ;
  CreateVar(1, "i", &opt_m1, &opt_n1, &opt_l1);  
  show_win(1);
  LhsVar(1) = 1;
  return 0;
}


builder.sce:

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













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



More information about the users mailing list