Skip to content

Instantly share code, notes, and snippets.

@mesaleh
Created April 18, 2015 01:12
Show Gist options
  • Save mesaleh/9b25ebaa0c3070f73814 to your computer and use it in GitHub Desktop.
Save mesaleh/9b25ebaa0c3070f73814 to your computer and use it in GitHub Desktop.
/*
* Moustafa Saleh (msaleh83@gmail.com)
*
* Test DLL
* Compile:
* GCC: gcc test_dll.c -o test_dll_gcc.dll -shared -Wl,--out-implib,test_dll_gcc.a -DBUILDING_TEST_DLL
* CL: cl test_dll.c kernel32.lib user32.lib /LD /D BUILDING_TEST_DLL
*/
#include <windows.h>
#ifdef BUILDING_TEST_DLL
#define TEST_DLL __declspec(dllexport)
#else
#define TEST_DLL __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C"
{
#endif
TEST_DLL void __stdcall bar()
{
MessageBox(0, "Welcome, you're in bar()!", "Test DLL", 0);
}
TEST_DLL void __stdcall foo()
{
MessageBox(0, "Welcome, you're in foo()!", "Test DLL", 0);
}
#ifdef __cplusplus
}
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment