Document of c-modernization-kit (override-sample) 1.0.0
Loading...
Searching...
No Matches
sample_func.c
Go to the documentation of this file.
1
15
16#include "funcman_libbase.h"
17#include <libbase.h>
18
19/* doxygen コメントは、ヘッダに記載 */
20int BASE_API sample_func(const int a, const int b, int *result)
21{
22 if (result == NULL)
23 {
24 return -1;
25 }
26
27 sample_func_t fp = funcman_get_func(pfo_sample_func, sample_func_t);
28 if (fp != NULL)
29 {
30 /* 拡張 (オーバーライド) 処理 */
31 console_output("sample_func: 拡張処理が見つかりました。拡張処理に移譲します\n");
32 return fp(a, b, result);
33 }
34 else
35 {
36 /* 基底 (デフォルト) 処理 */
37 console_output("sample_func: a=%d, b=%d の処理 (*result = a + b;) を行います\n", a, b);
38 *result = a + b;
39 return 0;
40 }
41}
funcman_object *const pfo_sample_func
sample_func に対応する funcman オブジェクトへのポインタ。
funcman が管理する関数ポインタの extern 定義。
int(* sample_func_t)(const int, const int, int *)
sample_func に対応する関数ポインタの型定義。
ベースライブラリ (動的リンク用) のヘッダーファイル。
BASE_EXPORT void BASE_API console_output(const char *format,...)
printf と同じ書式でコンソールに出力します。
#define BASE_API
呼び出し規約マクロ。
Definition libbase.h:46
int BASE_API sample_func(const int a, const int b, int *result)
計算処理を行います。
Definition sample_func.c:20