This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Exception handling across dll?


Does the shared library linking currently handle C++ exception handling
across dll properly? I have a sample program which tries to throw some
exception in dll and catch it in main program, which fails. If I use
static linking, it works.

The program uses autoxxx/libtool and is heavily borrowed from dllhelper
examples. My environment is cygwin 1.3.10 on 2K.

$ usedll
Aborted(core dumped)

****lt-usedll.exe.stackdump****
Stack trace:
Frame     Function  Args
0022F6D4  61058105  (000004F8, 00000006, 00000001, 00000103)
0022F714  61058342  (000004F8, 00000006, 0022F774, 61058789)
0022F734  610581CA  (00000006, 00000000, 0022F774, 61058754)
0022F774  6105879F  (00235678, 77F82207, 0022F794, 1000104D)
0022F784  1000103F  (77F82933, 00230000, 0022FE04, 1000125F)
0022F794  1000104D  (00000004, 610A0368, 00000001, 77FB9DA7)
0022FE04  1000125F  (10001000, 100071C4, 00000000, 004011FD)
0022FE24  1000102C  (00000004, 610A0368, 00000001, 000000F4)
0022FEB4  0040108D  (00000001, 6156C8A8, 10030278, 00000000)
0022FF10  61003F42  (00000000, 00000000, 00000000, 02000000)
0022FF40  61004236  (0040104C, 00000000, FF7CA020, 8104261C)
0022FF60  61004275  (00000000, 00000000, FF7CA1B0, 00000005)
0022FF90  004049A7  (0040104C, FFFFFFFF, 80430D77, 00000000)
0022FFC0  0040103D  (00000000, 00000000, 7FFDF000, 00000000)
0022FFF0  77E8D326  (00401000, 00000000, 000000C8, 00000100)
End of stack trace

****Makefile.am****
pkginclude_HEADERS	= cdll.h

lib_LTLIBRARIES		= libcdll.la
libcdll_la_SOURCES	= cdll.cpp
libcdll_la_LDFLAGS	= -version-info 1:0:1 -no-undefined

bin_PROGRAMS		= usedll
usedll_SOURCES		= usedll.cpp
usedll_LDADD		= libcdll.la

****configure.ac****
AC_INIT(cdll.cpp)
AC_PREREQ(2.52)
AM_INIT_AUTOMAKE(dllcpp, 0.1.0)

AC_PROG_CXX
AM_PROG_LIBTOOL
AC_HEADER_STDC
AC_OUTPUT([Makefile])

****cdll.cpp****
#include "cdll.h"
void dll_func() {
	throw "Exception";
}

****cdll.h****
#ifndef cdll_h_included
#define cdll_h_included

extern void dll_func () ;

#endif /* cdll_h_included */

****usedll.cpp****
#include <stdio.h>
#include "cdll.h"

int main () {
        try {
		dll_func();
        } catch(...) {
		printf("Caught\n");
        }
}				

-Willis


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]