Hello,

I'm trying to use some C code I've written, using the ctypes module.
So, I've compile my C code into a shared object and written the
following code into the sage notebook :

from ctypes import *
myobj=CDLL("/home/mourad/Documents/PSTL/Simulator/simulator.so")

#I specify the return type of my functions

myobj.load_matrice_from_file.restype = c_void_p
myobj.load_card_from_file.restype = c_void_p
myobj.load_measure_device_from_file.restype = c_void_p

myobj.fuite_carte_to_gnuplot.argtypes = [c_char_p, c_void_p, c_void_p,
c_void_p]

#I run my functions

#on teste nos fonctions

mat = myobj.load_matrice_from_file("/home/mourad/Documents/PSTL/
fichier_tests/msg_test.msg")
card = myobj.load_card_from_file("/home/mourad/Documents/PSTL/
fichier_tests/msg_test.msg")
md = myobj.load_measure_device_from_file("/home/mourad/Documents/PSTL/
fichier_tests/msg_test.msg")

myobj.fuite_carte_to_gnuplot("/home/mourad/test.gnu", mat, card, md)


This code rise a segmentation fault.
I think the problem is that, even if I specified the return type of my
functions, they return a Python int.

I'm using Sage 3.4.2

Thank you.

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to