Windows C SDK build for simulator: `eventHandler` forward declaration has wrong linkage

Hello!

I answered someone's question on the "Get Help" forum but figured it's a good idea to have a dedicated bug thread as well.

The issue is pd_api.h in the C SDK declares eventHandler as

// main entry point defined in game code, called for the above events
int eventHandler(PlaydateAPI* playdate, PDSystemEvent event, uint32_t arg);

whereas the examples all define eventHandler as

#ifdef _WINDLL
__declspec(dllexport)
#endif
int eventHandler(PlaydateAPI* playdate, PDSystemEvent event, uint32_t arg);

Trying to build as-is results in

Error	C2375	'eventHandler': redefinition; different linkage	hello_world	C:\PlaydateSDK\C_API\Examples\Hello World\src\main.c	21	

Can the declaration in pd_api.h be updated to include the Windows specific export?

#ifdef _WINDLL
__declspec(dllexport)
#endif

Thanks!
Owen

3 Likes

D'oh! Thanks for catching that, and thanks even more for helping out on the forum. Will be fixed in the next release!

4 Likes

No problem! Thanks for creating such an exciting platform, I'm having lots of fun exploring the C API :slight_smile: