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
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "ui.h"

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
#define testingprivScaffoldName(basename) testingprivScaffold ## basename
#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:
// - https://gitlab.gnome.org/GNOME/glib/blob/master/glib/gconstructor.h

View File

@ -1,6 +1,5 @@
// 6 april 2015
#include "uipriv_windows.hpp"
#include "attrstr.hpp"
HINSTANCE uipriv_hInstance = NULL;
int uipriv_nCmdShow;
@ -61,27 +60,27 @@ int uiInit(void *options, uiInitError *err)
return uiprivInitReturnHRESULT(err, errICCFailed, HRESULT_FROM_WIN32(lasterr));
}
hr = CoInitialize(NULL);
/* hr = CoInitialize(NULL);
if (hr != S_OK && hr != S_FALSE)
return ieHRESULT("initializing COM", hr);
// LONGTERM initialize COM security
// LONGTERM turn off COM exception handling
*/
uiprivMarkInitialized();
return 1;
}
void uiUninit(void)
{
CoUninitialize();
// CoUninitialize();
}
#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)
hInstance = hinstDLL;
uipriv_hInstance = hInstance;
return TRUE;
}

View File

@ -10,13 +10,13 @@ libui_sources += [
# 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.
# 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'
libui_sources += [
windows.compile_resources('resources.rc',
args: libui_manifest_args,
depend_files: ['libui.manifest']),
]
endif
#if libui_mode == 'shared'
# libui_sources += [
# windows.compile_resources('resources.rc',
# args: libui_manifest_args,
# depend_files: ['libui.manifest']),
# ]
#endif
foreach lib : ['user32', 'kernel32', 'gdi32', 'comctl32']
libui_deps += [