help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

exception propagated across module boundary, type unknown


From: ben mitch
Subject: exception propagated across module boundary, type unknown
Date: Sun, 29 Oct 2006 19:49:50 -0500
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)

hi

we are currently porting an application to linux and are having a problem. i'm no expert on linkage etc., least of all under linux, but it appears to me to be a symbol-resolution problem (possibly related to lazy/late binding of symbols?) in a shared library. the relevant modules are

manager (executable, but runs in fact under MATLAB as a mex file, i think for today's intent it will be like a standalone executable)
process.so (shared library that does a task for the manager)
core.so (shared library, used by manager and process, in particular defines the exception type EXCEPTION)

and the problem arises as follows:

* start manager (i.e. call it from matlab)
* manager calls function exported from process.so to create an object X
* manager spawns a new worker thread (posix)
* worker thread calls member function of X
* member function of X throws a custom exception EXCEPTION, defined in core.so
* exception propagates back up to manager (in worker thread)
* exception type is unrecognised (i.e. is caught by catch(...))

currently, we catch the unknown exception, wrap it up in a nice exception, and this eventually returns us to prompt, with information lost since we never saw the actual exception thrown by process. interestingly, if we call the manager to do the same thing again without rebuilding (and again and again), on all subsequent calls the manager recognises the thrown exception correctly, which is what made me think that binding is not getting done in time.

all is written in C++, compiled using g++ (details below). compiler switches are as follows:

core:
-pthread -O3 -ffast-math -Werror -fPIC -shared --export-dynamic

manager statically-linked component modules:
-pthread -O3 -ffast-math -Werror -fPIC -shared --export-dynamic

manager executable build:
-fPIC -ansi -D_GNU_SOURCE -pthread -O3 -ffast-math -DNDEBUG -pthread -shared -m32 --export-dynamic

process:
-pthread -O3 -ffast-math -Werror -fPIC -shared --export-dynamic

platform info:

MACHTYPE=i586-mandrake-linux-gnu
-bash-2.05b$ uname -a
Linux xxx.xxx.xxx.xxx 2.4.22-10mdk #1 Thu Sep 18 12:30:58 CEST 2003 i686 unknown unknown GNU/Linux
-bash-2.05b$ gcc --version
gcc (GCC) 3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk)


sorry if i left anything out, let me know. and thanks in advance for any help you can offer.

cheers
ben


reply via email to

[Prev in Thread] Current Thread [Next in Thread]