ALMOST fixed the build on Windows with MSVC. (For the change to test/testing.h: Even in VS2019 inline isn't available in C, ugh. That function doesn't need to be inline anyway, so eh.)

This commit is contained in:
Pietro Gagliardi 2019-04-21 15:08:09 -04:00
parent c6aa8c3324
commit f7867f3427
7 changed files with 34 additions and 26 deletions

View File

@ -1,4 +1,5 @@
// 19 april 2019 // 19 april 2019
#include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "ui.h" #include "ui.h"

View File

@ -1,7 +1,15 @@
// 19 april 2019 // 19 april 2019
#ifdef __cplusplus
extern "C" {
#endif
// init.c // init.c
extern int uiprivInitCheckParams(void *options, uiInitError *err, const char *initErrors[]); extern int uiprivInitCheckParams(void *options, uiInitError *err, const char *initErrors[]);
extern int uiprivInitReturnError(uiInitError *err, const char *msg); extern int uiprivInitReturnError(uiInitError *err, const char *msg);
extern int uiprivInitReturnErrorf(uiInitError *err, const char *msg, ...); extern int uiprivInitReturnErrorf(uiInitError *err, const char *msg, ...);
extern void uiprivMarkInitialized(void); extern void uiprivMarkInitialized(void);
#ifdef __cplusplus
}
#endif

View File

@ -142,7 +142,7 @@ libui_soversion = ''
libui_rpath = '' libui_rpath = ''
subdir('common') subdir('common')
if libui_OS == 'windows' if libui_OS == 'windows'
# subdir('windows') subdir('windows')
install_headers('ui_windows.h') install_headers('ui_windows.h')
elif libui_OS == 'darwin' elif libui_OS == 'darwin'
subdir('darwin') subdir('darwin')

View File

@ -6,17 +6,17 @@ libui_test_sources = [
'testing.c', 'testing.c',
] ]
if libui_OS == 'windows' #if libui_OS == 'windows'
libui_test_manifest = 'test.manifest' # libui_test_manifest = 'test.manifest'
if libui_mode == 'static' # if libui_mode == 'static'
libui_test_manifest = 'test.static.manifest' # libui_test_manifest = 'test.static.manifest'
endif # endif
libui_test_sources += [ # libui_test_sources += [
windows.compile_resources('resources.rc', # windows.compile_resources('resources.rc',
args: libui_manifest_args, # args: libui_manifest_args,
depend_files: [libui_test_manifest]), # depend_files: [libui_test_manifest]),
] # ]
endif #endif
# TODO once we upgrade to 0.49.0, add pie: true # TODO once we upgrade to 0.49.0, add pie: true
# TODO once we upgrade to 0.50.0, add protocol: 'exitcode' # TODO once we upgrade to 0.50.0, add protocol: 'exitcode'

View File

@ -6,7 +6,7 @@
#define testingprivScaffoldName(basename) testingprivScaffold ## basename #define testingprivScaffoldName(basename) testingprivScaffold ## basename
#define testingprivMkScaffold(basename, argtype, argname) \ #define testingprivMkScaffold(basename, argtype, argname) \
static inline void testingprivScaffoldName(basename)(argtype *argname) { testingprivImplName(basename)(argname); } static void testingprivScaffoldName(basename)(argtype *argname) { testingprivImplName(basename)(argname); }
// references: // references:
// - https://gitlab.gnome.org/GNOME/glib/blob/master/glib/gconstructor.h // - https://gitlab.gnome.org/GNOME/glib/blob/master/glib/gconstructor.h

View File

@ -1,6 +1,5 @@
// 6 april 2015 // 6 april 2015
#include "uipriv_windows.hpp" #include "uipriv_windows.hpp"
#include "attrstr.hpp"
HINSTANCE uipriv_hInstance = NULL; HINSTANCE uipriv_hInstance = NULL;
int uipriv_nCmdShow; int uipriv_nCmdShow;
@ -61,27 +60,27 @@ int uiInit(void *options, uiInitError *err)
return uiprivInitReturnHRESULT(err, errICCFailed, HRESULT_FROM_WIN32(lasterr)); return uiprivInitReturnHRESULT(err, errICCFailed, HRESULT_FROM_WIN32(lasterr));
} }
hr = CoInitialize(NULL); /* hr = CoInitialize(NULL);
if (hr != S_OK && hr != S_FALSE) if (hr != S_OK && hr != S_FALSE)
return ieHRESULT("initializing COM", hr); return ieHRESULT("initializing COM", hr);
// LONGTERM initialize COM security // LONGTERM initialize COM security
// LONGTERM turn off COM exception handling // LONGTERM turn off COM exception handling
*/
uiprivMarkInitialized(); uiprivMarkInitialized();
return 1; return 1;
} }
void uiUninit(void) void uiUninit(void)
{ {
CoUninitialize(); // CoUninitialize();
} }
#ifndef uiStatic #ifndef uiStatic
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, LPVOID lpvReserved)
{ {
if (fdwReason == DLL_PROCESS_ATTACH) if (fdwReason == DLL_PROCESS_ATTACH)
hInstance = hinstDLL; uipriv_hInstance = hInstance;
return TRUE; return TRUE;
} }

View File

@ -10,13 +10,13 @@ libui_sources += [
# For a DLL, we have to include this directly, so we do so. # For a DLL, we have to include this directly, so we do so.
# Windows won't link resources in static libraries, so including this would have no effect. # Windows won't link resources in static libraries, so including this would have no effect.
# In those cases, we just need them to include the manifest with the executable (or link it directly into the output executable themselves); they can also customize the manifest as they see fit (assuming nothing breaks in the process). # In those cases, we just need them to include the manifest with the executable (or link it directly into the output executable themselves); they can also customize the manifest as they see fit (assuming nothing breaks in the process).
if libui_mode == 'shared' #if libui_mode == 'shared'
libui_sources += [ # libui_sources += [
windows.compile_resources('resources.rc', # windows.compile_resources('resources.rc',
args: libui_manifest_args, # args: libui_manifest_args,
depend_files: ['libui.manifest']), # depend_files: ['libui.manifest']),
] # ]
endif #endif
foreach lib : ['user32', 'kernel32', 'gdi32', 'comctl32'] foreach lib : ['user32', 'kernel32', 'gdi32', 'comctl32']
libui_deps += [ libui_deps += [