[Pyrex] Main function for Pyrex: cimport causes segmentation fault
Alain Pointdexter
alainpoint at yahoo.fr
Fri Apr 15 11:38:53 CEST 2005
The example i gave contained an empty dishes.pyx
I then tried to to fill it with some useful stuf.
Here are the files:
# dishes.pxd
cdef class Testclass:
cdef public int someint
cdef public char *somestring
# dishes.pyx
cdef class Testclass:
def __init__(self):
self.someint = 43
self.somestring = "this is a string"
def hello(self):
print "Hello, this is an instance of %s" %
self.__class__.__name__
# restaurant.pyx
from dishes cimport Testclass
cdef test_function():
printf("Instantiating Testclass\n")
testobj =Testclass()
printf("testmain: created testobj\n")
print "testobj.someint = %s" % testobj.someint
print "testobj.somestring = %s" % testobj.somestring
print "calling testobj.hello()"
testobj.hello()
def main(arglist):
test_function()
return 0
The compilation sequence is the same as in the
previous mail.
Running the application causes a segmentation fault.
Alain
__________________________________________________________________
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/
More information about the Pyrex
mailing list