diff --git a/src/_cocoalayer.mm b/src/_cocoalayer.mm index a02312395..7ac573df9 100644 --- a/src/_cocoalayer.mm +++ b/src/_cocoalayer.mm @@ -1,9 +1,14 @@ #if defined(__APPLE__) + #import #import #include "_cocoalayer.h" -// Example: make a global function you can call -extern "C" void CocoaSetDockIcon(unsigned char* data, int width, int height) + +#ifdef __cplusplus +extern "C" { +#endif + +void CocoaSetDockIcon(unsigned char* data, int width, int height) { NSImage *dockIcon = [[NSImage alloc] initWithSize:NSMakeSize(width, height)]; CGDataProviderRef provider = CGDataProviderCreateWithData(nullptr, data, width*height*4, nullptr); @@ -17,4 +22,10 @@ extern "C" void CocoaSetDockIcon(unsigned char* data, int width, int height) CGColorSpaceRelease(colorSpace); CGDataProviderRelease(provider); } + + +#ifdef __cplusplus +} +#endif + #endif