From a448a31cab64ab684a79bb179de7a859f8f9da1a Mon Sep 17 00:00:00 2001 From: Alejandro Sior Date: Sat, 6 Aug 2022 21:26:03 +0200 Subject: cook: add preliminary MSVC C toolchain support It cannot properly create and link against .DLLs yet, the current implementation of it is a hack (using mkextra). Static libraries, executables as well as cc work in a respectable manner. --- test/.build | 8 ++++--- test/hai.c | 8 +++++++ test/hai.h | 3 +++ test/main.c | 78 +++---------------------------------------------------------- 4 files changed, 19 insertions(+), 78 deletions(-) create mode 100644 test/hai.c create mode 100644 test/hai.h (limited to 'test') diff --git a/test/.build b/test/.build index 96b8226..61983a3 100644 --- a/test/.build +++ b/test/.build @@ -1,3 +1,5 @@ -obj = cc("main.c") -l = lib("vol", obj) -aout = exe("vol", l, libs=["Xm", "Xt"]) \ No newline at end of file +maino = cc("main.c") +haio = cc("hai.c") +hailib = shlib("hai", haio) + +aout = exe("vol", maino, hailib) \ No newline at end of file diff --git a/test/hai.c b/test/hai.c new file mode 100644 index 0000000..263a8de --- /dev/null +++ b/test/hai.c @@ -0,0 +1,8 @@ +#include "hai.h" + +#include + +__declspec(dllexport) +void hai() { + printf("lol\n"); +} \ No newline at end of file diff --git a/test/hai.h b/test/hai.h new file mode 100644 index 0000000..5da3133 --- /dev/null +++ b/test/hai.h @@ -0,0 +1,3 @@ +__declspec(dllexport) +void hai(); +// test \ No newline at end of file diff --git a/test/main.c b/test/main.c index 25c49da..3763706 100644 --- a/test/main.c +++ b/test/main.c @@ -1,81 +1,9 @@ - #include -#include -#include -#include -#include -#include -#include - -int lol() { - printf("yes!\n"); - return 0; -} +#include "hai.h" int main(int argc, char **argv) { - XtAppContext app; - Widget toplevel = XtVaAppInitialize(&app, "Demo", NULL, 0, &argc, argv, NULL, NULL); - - /*Widget mainw = XtVaCreateManagedWidget("main_window", - xmMainWindowWidgetClass, toplevel, - XmNscrollBarDisplayPolicy, XmAS_NEEDED, - XmNscrollingPolicy, XmAUTOMATIC, - NULL); - - XmString file = XmStringCreateLocalized("File"); - XmString edit = XmStringCreateLocalized("Edit"); - Widget menu = XmVaCreateSimpleMenuBar(mainw, "menubar", - XmVaCASCADEBUTTON, file, 'F', - XmVaCASCADEBUTTON, edit, 'E', - NULL); - XmStringFree(edit); - XmStringFree(file); - - XtManageChild(menu); */ - - Widget form = XmVaCreateForm(toplevel, "form", - XmNfractionBase, 90, - NULL); - XtManageChild(form); - - Widget left = XmVaCreateArrowButton(form, "voldown", - XmNarrowDirection, XmARROW_LEFT, - XmNtopAttachment, XmATTACH_FORM, - XmNleftAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_POSITION, - XmNrightPosition, 30, - NULL); - XtAddCallback(left, XmNactivateCallback, (XtCallbackProc)lol, NULL); - XtAddCallback(left, XmNdisarmCallback, (XtCallbackProc)lol, NULL); - XtManageChild(left); - - - Widget pb = XmVaCreatePushButton(form, "Volume", - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, left, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - XmNrightAttachment, XmATTACH_POSITION, - XmNrightPosition, 60, - NULL); - XtAddCallback(pb, XmNactivateCallback, (XtCallbackProc)lol, NULL); - XtManageChild(pb); - - Widget right = XmVaCreateArrowButton(form, "volup", - XmNarrowDirection, XmARROW_RIGHT, - XmNleftAttachment, XmATTACH_WIDGET, - XmNleftWidget, pb, - XmNrightAttachment, XmATTACH_FORM, - XmNtopAttachment, XmATTACH_FORM, - XmNbottomAttachment, XmATTACH_FORM, - NULL); - XtAddCallback(right, XmNactivateCallback, (XtCallbackProc)lol, NULL); - XtAddCallback(right, XmNdisarmCallback, (XtCallbackProc)lol, NULL); - XtManageChild(right); - - XtRealizeWidget(toplevel); - XtAppMainLoop(app); + printf("Hello world\n"); + hai(); return 0; } -- cgit v1.2.3