I would suggest you do the following:
Since you are writing library C++ and using its symbols from Lisp, make sure that you use
extern "C"
declarations - those are needed to ensure that C++ compiler does not mangle names.Check that your library works in a C (not C++) application. This will ensure that the library itself is working (e.g., it does not throw C++ exceptions).
UPD:
I've tried to run your code and had the same crash. The problem seems to be in your create_application
function. I've attached my fixed version of this function at http://paste.lisp.org/display/138049.
Concretely, there are 2 problems:
create_application
allocatedv
on stack. Subsequent code (i.e., thelet
binding) overwrites it.argv
should beNULL
-terminated. I.e., it should containargc+1
elements - the last element is NULL. (Qt seems to not use this, but it is good habit to write code according to specs).
In your case, the stack allocation is the problem - it seems that let
binding overwrites the value of v
on stack, crashing SBCL. Using malloc
or new
to allocate argv
on heap fixes this issue.