Document of c-modernization-kit (override-sample)
1.0.0
Loading...
Searching...
No Matches
override-sample
libsrc
base
dllmain_libbase.c
Go to the documentation of this file.
1
18
19
#include "
funcman_libbase.h
"
20
#include <dllmain.h>
21
#include <stdio.h>
22
23
/* doxygen コメントは、ヘッダに記載 */
24
void
onLoad
(
void
)
25
{
26
char
basename[FUNCMAN_NAME_MAX] = {0};
27
28
DLLMAIN_INFO_MSG(
"base: onLoad called"
);
29
30
if
(get_lib_basename(basename,
sizeof
(basename), (
const
void
*)
onLoad
) == 0)
31
{
32
#ifndef _WIN32
33
/* Linux: 定義ファイルを /tmp から読み込み */
34
snprintf(
funcman_configpath
,
sizeof
(
funcman_configpath
),
"/tmp/%s_extdef.txt"
, basename);
35
#else
/* _WIN32 */
36
/* Windows: 定義ファイルを %TEMP% から読み込み */
37
wchar_t
tmpw[MAX_PATH] = L
""
;
38
DWORD n = GetTempPathW((DWORD)(
sizeof
(tmpw) /
sizeof
(tmpw[0])), tmpw);
39
if
(n > 0 && n < (DWORD)(
sizeof
(tmpw) /
sizeof
(tmpw[0])))
40
{
41
/* UTF-16 -> UTF-8 変換 */
42
char
tmpu8[MAX_PATH * 4] = {0};
43
int
m = WideCharToMultiByte(CP_UTF8, 0, tmpw, -1, tmpu8, (
int
)
sizeof
(tmpu8), NULL, NULL);
44
if
(m > 0)
45
{
46
/* GetTempPathW は通常末尾に '\' を付けて返す */
47
snprintf(
funcman_configpath
,
sizeof
(
funcman_configpath
),
"%s%s_extdef.txt"
, tmpu8, basename);
48
}
49
}
50
#endif
/* _WIN32 */
51
}
52
53
funcman_init(
fobj_array_libbase
,
fobj_length_libbase
,
funcman_configpath
);
54
}
55
56
/* doxygen コメントは、ヘッダに記載 */
57
void
onUnload
(
void
)
58
{
59
DLLMAIN_INFO_MSG(
"base: onUnload called"
);
60
funcman_dispose(
fobj_array_libbase
,
fobj_length_libbase
);
61
}
onLoad
void onLoad(void)
Definition
dllmain_libbase.c:24
onUnload
void onUnload(void)
Definition
dllmain_libbase.c:57
funcman_configpath
char funcman_configpath[FUNCMAN_CONFIG_PATH_MAX]
funcman 設定ファイルのパス
Definition
funcman_libbase.c:21
fobj_length_libbase
const size_t fobj_length_libbase
funcman に設定するポインタ配列の要素数
Definition
funcman_libbase.c:44
fobj_array_libbase
funcman_object *const fobj_array_libbase[]
funcman に設定するポインタ配列。
Definition
funcman_libbase.c:38
funcman_libbase.h
funcman が管理する関数ポインタの extern 定義。
Generated by
1.14.0