ObjFW  Check-in [6bb25d33ac]

Overview
Comment:Make ObjC++ exceptions work with libc++ on Windows
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 1.2
Files: files | file ages | folders
SHA3-256: 6bb25d33ac3e19eb97bf92320ed74661b71f7518b20d4e0004fc1c9a0f9ad634
User & Date: js on 2024-11-08 20:57:34
Other Links: branch diff | manifest | tags
Context
2024-11-08
22:43
OFColor: Improve style of deprecation message check-in: ff29e35344 user: js tags: 1.2
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:07
Merge trunk into 1.2 branch check-in: 10cce4f6ef user: js tags: 1.2
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 =