More build stuff.

This commit is contained in:
Pietro Gagliardi 2015-11-25 13:17:32 -05:00
parent a336cdcf4a
commit 896beb036d
7 changed files with 18 additions and 69 deletions

View File

@ -1,3 +0,0 @@
cl /clr /AI "c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0" wpf.cpp /link /dll /out:wpf.dll ole32.lib
cl /Tc program.c /link /out:program.exe wpf.lib

View File

@ -2,7 +2,7 @@
#ifdef __cplusplus #ifdef __cplusplus
#error msbuild is being dumb and making this a C++ file #error msbuild is being dumb and making this a C++ file
#endif #endif
#include "../windows/winapi.h" #include "winapi.h"
#include "../ui.h" #include "../ui.h"
// TODO to make sure wpfInit() is exported properly // TODO to make sure wpfInit() is exported properly
#include "wpf.h" #include "wpf.h"

View File

@ -50,6 +50,7 @@
<!-- TODO should be EnableAllWarnings but that enables way too much --> <!-- TODO should be EnableAllWarnings but that enables way too much -->
<WarningLevel>Level4</WarningLevel> <WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader> <PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>_UI_EXTERN=__declspec(dllexport) extern</PreprocessorDefinitions>
<!-- TODO there's a better way for this --> <!-- TODO there's a better way for this -->
<!-- do not warn about unreferended parameters --> <!-- do not warn about unreferended parameters -->
<AdditionalOptions>/wd4100</AdditionalOptions> <AdditionalOptions>/wd4100</AdditionalOptions>
@ -69,12 +70,11 @@
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
<ClInclude Include="wpf.h" /> <ClCompile Include="init.c">
<ClCompile Include="sta.c">
<CompileAsManaged>false</CompileAsManaged> <CompileAsManaged>false</CompileAsManaged>
</ClCompile> </ClCompile>
<ClCompile Include="wpf.cpp" />
<ClCompile Include="winapi.h" />
<ClCompile Include="..\ui.h" /> <ClCompile Include="..\ui.h" />

View File

@ -1,22 +0,0 @@
// 24 november 2015
#include <stdio.h>
#include "wpf.h"
static void onClosing(wpfWindow *w, void *data)
{
printf("exiting\n");
wpfQuit();
}
int main(void)
{
wpfWindow *w;
wpfInit();
w = wpfNewWindow("Hi", 320, 240);
wpfWindowOnClosing(w, onClosing, NULL);
wpfRun();
printf("out\n");
return 0;
}

13
wpf/winapi.h Normal file
View File

@ -0,0 +1,13 @@
// 31 may 2015
#define UNICODE
#define _UNICODE
#define STRICT
#define STRICT_TYPED_ITEMIDS
// get Windows version right; right now Windows Vista
#define WINVER 0x0600 /* according to Microsoft's winnls.h */
#define _WIN32_WINNT 0x0600 /* according to Microsoft's sdkddkver.h */
#define _WIN32_WINDOWS 0x0600 /* according to Microsoft's pdh.h */
#define _WIN32_IE 0x0700 /* according to Microsoft's sdkddkver.h */
#define NTDDI_VERSION 0x06000000 /* according to Microsoft's sdkddkver.h */
#include <windows.h>
#include <stdarg.h>

View File

@ -1,22 +0,0 @@
// 24 november 2015
#ifndef EXPORT
#define EXPORT __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct wpfWindow wpfWindow;
extern EXPORT wpfWindow *wpfNewWindow(const char *title, int width, int height);
extern EXPORT void wpfWindowOnClosing(wpfWindow *w, void (*f)(wpfWindow *w, void *data), void *data);
extern EXPORT void wpfInit(void);
extern EXPORT void wpfRun(void);
extern EXPORT void wpfQuit(void);
#ifdef __cplusplus
}
#endif

View File

@ -1,17 +0,0 @@
// 24 november 2015
#using <System.dll>
#using <WindowsBase.dll>
#using <PresentationCore.dll>
#using <PresentationFramework.dll>
using namespace System;
using namespace System::ComponentModel;
int main(void)
{
System::ComponentModel::CancelEventArgs ^e;
e = gcnew CancelEventArgs();
e->Cancel = true;
System::Console::WriteLine(e->Cancel);
return 0;
}