Skip to content

Commit 4812438

Browse files
committed
attempt to solve to fetch the struct member, calculating the offset manually.
1 parent 1b12772 commit 4812438

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ext/intl/calendar/calendar_class.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,13 @@ typedef struct {
4343
} Calendar_object;
4444

4545
static inline Calendar_object *php_intl_calendar_fetch_object(zend_object *obj) {
46+
#ifndef __cplusplus
4647
return (Calendar_object *)((char*)(obj) - XtOffsetOf(Calendar_object, zo));
48+
#else
49+
Calendar_object empty;
50+
size_t offset = reinterpret_cast<char *>(&empty.zo) - reinterpret_cast<char *>(&empty);
51+
return reinterpret_cast<Calendar_object *>(reinterpret_cast<char *>(obj) - offset);
52+
#endif
4753
}
4854
#define Z_INTL_CALENDAR_P(zv) php_intl_calendar_fetch_object(Z_OBJ_P(zv))
4955

0 commit comments

Comments
 (0)