📖
📖
📖
📖
Job Memo
Search…
Cheat sheets of git and repo
Implement your own HIDL
Communicate with Kernel driver
Compile your own kernel and install
Notes of GDBus
introduction of Yocto project
Yocto – how to initialize your module?
Useful Linux Commands
Benefits of using Macro
Samba to create sharing folders between host and VM
How to write a daemon?
C/C++
Use dlopen and dlsym to get handler of dynamic library(.so)
argc? argv ?
How to use C api in C++ ?
What is void* ?
Utilize function pointers to build Handlers
Concepts of Makefile
Makefile parameters
Powered By
GitBook
What is void* ?
我目前知道的如下:
未定型的指標,可以等到需要轉型時再指定型別: void *p1; int *p2; p1 = p2;
也可以放在函式參數裡,最後再決定要傳入什麼類型的指標 void * memcpy( void *dest, const void *src, size_t len ); void * memset( void * buffer, int c, size_t num);
給 callback function 使用: 用在沒有回傳值的 event function 例如:
|Code| 使用 function pointer 建立 Handler
裡面的
int
demo_funcA(int, uint8_t); 改為
void
demo_funcA(int, uint8_t); typedef
int
(*cmd_handler)(int,uint8_t); 就要改為:typedef void (*cmd_handler)(int,uint8_t);
p.s.在 C++中,函式參數為void的意思是這個函數不需要任何參數
很方便的東西,特別是搭配 callback function 用~~
C/C++ - Previous
How to use C api in C++ ?
Next - C/C++
Utilize function pointers to build Handlers
Last modified
5mo ago
Copy link