ReactOS
0.4.17-dev-573-g8315b8c
imp_alias.h
Go to the documentation of this file.
1
/*
2
* PROJECT: ReactOS SDK
3
* LICENSE: MIT (https://spdx.org/licenses/MIT)
4
* PURPOSE: Helpers to define dllimport slots bound to static functions
5
* COPYRIGHT: Copyright 2026 Ahmed Arif <arif.ing@outlook.com>
6
*/
7
8
#pragma once
9
10
/*
11
* __imp_<sym> carries <sym>'s platform decoration: on i386 cdecl foo gets __imp__foo, one-argument stdcall
12
* bar gets __imp__bar@4. Spell the slot names through asm labels, a plain C variable would be decorated
13
* again. The bound-to function is referenced through an asm label as well, so the macros work no matter
14
* how (or whether) the surrounding TU declares it.
15
*/
16
17
#if defined(__i386__)
18
#define IMP_TARGET_CDECL(name) "_"
#name
19
#define IMP_SYMBOL_CDECL(name) "__imp__"
#name
20
#define IMP_SYMBOL_STDCALL(name, size) "__imp__"
#name "@" #size
21
#else
22
#define IMP_TARGET_CDECL(name) #name
23
#define IMP_SYMBOL_CDECL(name) "__imp_"
#name
24
#define IMP_SYMBOL_STDCALL(name, size) "__imp_"
#name
25
#endif
26
27
/* Slot for a cdecl function, bound to the function of the same name */
28
#define IMP_ALIAS_CDECL(name) \
29
extern char __imp_alias_target_##name[] __asm__(IMP_TARGET_CDECL(name)); \
30
const void *__imp_alias_##name __asm__(IMP_SYMBOL_CDECL(name)) = \
31
(const void *)&__imp_alias_target_##name
32
33
/* Slot for a stdcall function with `size` argument bytes, bound to an ABI-compatible target */
34
#define IMP_ALIAS_STDCALL(name, size, target) \
35
const void *__imp_alias_##name __asm__(IMP_SYMBOL_STDCALL(name, size)) = \
36
(const void *)&target
sdk
include
reactos
imp_alias.h
Generated on Sat Aug 1 2026 06:18:14 for ReactOS by
1.9.6