Added CFLAGS option and exception on dlsym crash.

parent a8765c61
......@@ -47,6 +47,12 @@ PyObject *bisondynlib_run(void *handle, PyObject *parser, void *cb, void *in, in
//printf("bisondynlib_run: looking up parser\n");
pparser = bisondynlib_lookup_parser(handle);
//printf("bisondynlib_run: calling parser, py_input=0x%lx\n", in);
if (!pparser) {
PyErr_SetString(PyExc_RuntimeError,
"bisondynlib_lookup_parser() returned NULL");
return NULL;
}
(*pparser)(parser, cb, in, debug);
//printf("bisondynlib_run: back from parser\n");
//return result;
......
......@@ -528,7 +528,9 @@ cdef class ParserEngine:
# extra_preargs=['/DWIN32', '/G4', '/Gs', '/Oit', '/MT', '/nologo', '/W3', '/WX', '/Id:\python23\include'])
# link 'em into a shared lib
objs = ccompiler.compile([parser.bisonCFile1, parser.flexCFile1])
objs = ccompiler.compile([parser.bisonCFile1, parser.flexCFile1],
extra_preargs=parser.cflags_pre,
extra_postargs=parser.cflags_post)
libFileName = parser.bisonEngineLibName+imp.get_suffixes()[0][0]
if os.path.isfile(libFileName+".bak"):
try:
......@@ -551,7 +553,10 @@ cdef class ParserEngine:
'bisonCFile1', 'bisonHFile1', 'flexFile',
'flexCFile', 'flexCFile1',
] + objs:
fname = getattr(parser, name, None)
if hasattr(parser, name):
fname = getattr(parser, name)
else:
fname = None
#print "want to delete %s" % fname
if fname and os.path.isfile(fname):
hitlist.append(fname)
......
......@@ -242,6 +242,9 @@ class BisonParser(object):
flexCFile1 = "tmp.lex.c" # c output file from lex gets renamed to this
cflags_pre = ['-fPIC'] # = CFLAGS added before all arguments.
cflags_post = ['-O3','-g'] # = CFLAGS added after all arguments.
verbose = 0
file = None # default to sys.stdin
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment