diff --git a/doc/plugin-dev.md b/doc/plugin-dev.md index 367a2e024..9b27a18e1 100644 --- a/doc/plugin-dev.md +++ b/doc/plugin-dev.md @@ -61,8 +61,8 @@ All plugins require this boilerplate, so feel free to copy and paste it. --- -### Writing plugins in other languages -When writing plugins with C++, game headers must be surroundined with `extern "C"`, i.e. +### Writing plugins in C++ +When including game headers, they must be surrounded with `extern "C"`, i.e. ```C extern "C" { #include "src/Chat.h" @@ -71,6 +71,15 @@ extern "C" { ``` Otherwise you will get obscure `Undefined reference` errors when compiling. +Exported plugin functions must be surrounded with `extern "C"`, i.e. +```C +extern "C" { +EXPORT int Plugin_ApiVersion = 1; +EXPORT struct IGameComponent Plugin_Component = { TestPlugin_Init }; +} +``` +Otherwise your plugin will not load. (you'll see `error getting plugin version` in-game) + --- ### Linux diff --git a/src/Window.c b/src/Window.c index 5e02d6445..4fce890ad 100644 --- a/src/Window.c +++ b/src/Window.c @@ -706,9 +706,9 @@ static ATOM DoRegisterClass(void) { wc.lpfnWndProc = Window_Procedure; wc.lpszClassName = CC_WIN_CLASSNAME; - wc.hIcon = (HICON)LoadImage(win_instance, MAKEINTRESOURCE(1), IMAGE_ICON, + wc.hIcon = (HICON)LoadImageA(win_instance, MAKEINTRESOURCEA(1), IMAGE_ICON, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), 0); - wc.hIconSm = (HICON)LoadImage(win_instance, MAKEINTRESOURCE(1), IMAGE_ICON, + wc.hIconSm = (HICON)LoadImageA(win_instance, MAKEINTRESOURCEA(1), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0); wc.hCursor = LoadCursorA(NULL, IDC_ARROW); @@ -741,7 +741,7 @@ static void DoCreateWindow(ATOM atom, int width, int height) { void Window_Create(int width, int height) { ATOM atom; - win_instance = GetModuleHandle(NULL); + win_instance = GetModuleHandleA(NULL); /* TODO: UngroupFromTaskbar(); */ width = Display_ScaleX(width); height = Display_ScaleY(height);