-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c7083ae
commit 8afe11e
Showing
1 changed file
with
13 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,35 @@ | ||
#ifndef CALLBACK_DEMO_H | ||
#define CALLBACK_DEMO_H | ||
|
||
#ifdef _WIN32 | ||
#define DLL_EXPORT __declspec(dllexport) | ||
#else | ||
#define DLL_EXPORT | ||
#endif | ||
|
||
DLL_EXPORT void YourFunction(); // Example function declaration | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef const void (*CallbackFunction)(int, char*, size_t); | ||
|
||
// Simple function that prints a number to the console | ||
void printNumberInDec(int number, char* buffer, size_t bufferSize); | ||
DLL_EXPORT void printNumberInDec(int number, char* buffer, size_t bufferSize); | ||
|
||
// Simple function that prints a number to the console in hex | ||
void printNumberInHex(int number, char* buffer, size_t bufferSize); | ||
DLL_EXPORT void printNumberInHex(int number, char* buffer, size_t bufferSize); | ||
|
||
// Function that takes a function pointer as an argument and | ||
// set the callback function to the one passed in | ||
void setCallback(CallbackFunction callback); | ||
DLL_EXPORT void setCallback(CallbackFunction callback); | ||
|
||
// Run the callback function with the given number | ||
void runCallback(int number, char* buffer, size_t bufferSize); | ||
DLL_EXPORT void runCallback(int number, char* buffer, size_t bufferSize); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif // CALLBACK_DEMO_H | ||
#endif // CALLBACK_DEMO_H |