Document of c-modernization-kit (override-sample) 1.0.0
Loading...
Searching...
No Matches
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 コメントは、ヘッダに記載 */
24void 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
54}
55
56/* doxygen コメントは、ヘッダに記載 */
57void onUnload(void)
58{
59 DLLMAIN_INFO_MSG("base: onUnload called");
61}
void onLoad(void)
void onUnload(void)
char funcman_configpath[FUNCMAN_CONFIG_PATH_MAX]
funcman 設定ファイルのパス
const size_t fobj_length_libbase
funcman に設定するポインタ配列の要素数
funcman_object *const fobj_array_libbase[]
funcman に設定するポインタ配列。
funcman が管理する関数ポインタの extern 定義。