ObjFW  Check-in [c97a357529]

Overview
Comment:Make ObjC++ exceptions work with libc++ on Windows
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c97a357529db8ae7b4597f2992c8cf0a9e5aec73e5ef5dc3dc9c2d8de168279b
User & Date: js on 2024-11-08 20:56:50
Other Links: manifest | tags
Context
2024-11-08
22:43
OFColor: Improve style of deprecation message check-in: 5204353c50 user: js tags: trunk
20:57
Make ObjC++ exceptions work with libc++ on Windows check-in: 6bb25d33ac user: js tags: 1.2
20:56
Make ObjC++ exceptions work with libc++ on Windows check-in: c97a357529 user: js tags: trunk
2024-11-07
21:17
Add support for MPTCP check-in: 49f5cd5ec5 user: js tags: trunk
Changes

Modified src/runtime/exception.m from [7f6288ce90] to [b7aba5c4db].

788
789
790
791
792
793
794
795
796
797
798
799
800

801
802


803

804
805
806
807
808
809
810
811
812
typedef EXCEPTION_DISPOSITION (*seh_personality_fn)(PEXCEPTION_RECORD, void *,
    PCONTEXT, PDISPATCHER_CONTEXT);
static seh_personality_fn __gxx_personality_seh0;

OF_CONSTRUCTOR()
{
	/*
	 * This only works if the application uses libstdc++-6.dll.
	 * There is unfortunately no other way, as Windows does not support
	 * proper weak linking.
	 */

	HMODULE module;

	if ((module = GetModuleHandle("libstdc++-6")) == NULL)
		return;




	__gxx_personality_seh0 = (seh_personality_fn)
	    GetProcAddress(module, "__gxx_personality_seh0");
}

EXCEPTION_DISPOSITION
__gnu_objc_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame,
    PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp)
{
	struct _Unwind_Exception *ex =







|
|
|



>
|
|
>
>

>
|
|







788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
typedef EXCEPTION_DISPOSITION (*seh_personality_fn)(PEXCEPTION_RECORD, void *,
    PCONTEXT, PDISPATCHER_CONTEXT);
static seh_personality_fn __gxx_personality_seh0;

OF_CONSTRUCTOR()
{
	/*
	 * This only works if the application uses libc++.dll or
	 * libstdc++-6.dll. There is unfortunately no other way, as Windows
	 * does not support proper weak linking.
	 */

	HMODULE module;

	module = GetModuleHandle("libc++");

	if (module == NULL)
		module = GetModuleHandle("libstdc++-6");

	if (module != NULL)
		__gxx_personality_seh0 = (seh_personality_fn)
		    GetProcAddress(module, "__gxx_personality_seh0");
}

EXCEPTION_DISPOSITION
__gnu_objc_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame,
    PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp)
{
	struct _Unwind_Exception *ex =