This repository was archived by the owner on Jan 26, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3232#include <winsock2.h>
3333#endif
3434
35+ #ifdef _MSC_VER
36+ #define CONSTRUCTOR_ATTRIBUTE (_func ) static void _func(void); \
37+ static int _func ## _wrapper(void) { _func(); return 0; } \
38+ __pragma(section(".CRT$XCU",read)) \
39+ __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _wrapper;
40+ #define DESTRUCTOR_ATTRIBUTE (_func ) static void _func(void); \
41+ static int _func ## _constructor(void) { atexit (_func); return 0; } \
42+ __pragma(section(".CRT$XCU",read)) \
43+ __declspec(allocate(".CRT$XCU")) static int (* _array ## _func)(void) = _func ## _constructor;
44+ #else
3545#ifdef HAVE_CONSTRUCTOR_ATTRIBUTE
36- #define CONSTRUCTOR_ATTRIBUTE __attribute__((constructor))
46+ #define CONSTRUCTOR_ATTRIBUTE ( _func ) void _func(void) __attribute__((constructor))
3747#else
38- #define CONSTRUCTOR_ATTRIBUTE
48+ #define CONSTRUCTOR_ATTRIBUTE ( _func )
3949#endif /* HAVE_CONSTRUCTOR_ATTRIBUTE */
4050
4151#ifdef HAVE_DESTRUCTOR_ATTRIBUTE
42- #define DESTRUCTOR_ATTRIBUTE __attribute__((destructor))
52+ #define DESTRUCTOR_ATTRIBUTE ( _func ) void _func(void) __attribute__((destructor))
4353#else
44- #define DESTRUCTOR_ATTRIBUTE
54+ #define DESTRUCTOR_ATTRIBUTE ( _func )
4555#endif /* HAVE_DESTRUCTOR_ATTRIBUTE */
56+ #endif
4657
4758/* Declare static mutex */
4859static SSH_MUTEX ssh_init_mutex = SSH_MUTEX_STATIC_INIT ;
You can’t perform that action at this time.
0 commit comments