1. before you start
build the dll, then compile a file of your own against it
by the end of this page the dll is built and you have a main.c of your own that loads it. it does
nothing yet, that is page 2
windows only for now. the mac build leaves the abi out, so on a mac take the c++ track instead
build the dll
you need vs2022 with the desktop development with c++ workload. then from cpp\
build.batthat leaves window.abi.dll and window.abi.lib in cpp\bin\x64_Debug\. if it fails,
building it and what it needs have the long version
make your own file
a new folder anywhere, outside the lib, with one file in it
//
// my first window
//
#include "abi/window_abi.h"
#include <stdio.h>
int main(void)
{
// the dll says which abi it speaks, and it has to match the header we compiled against
if (gui_abi_version() != GUI_ABI_VERSION)
{
printf("wrong dll, it speaks abi %d\n", gui_abi_version());
return 1;
}
printf("abi %d, all good\n", gui_abi_version());
return 0;
}compile it
every page after this uses the same commands. from the x64 native tools command prompt for vs 2022,
a plain prompt has no cl in it, and swap the path for wherever the lib lives
set GUI=C:\path\to\gui-lib\cpp
cl main.c /I "%GUI%" "%GUI%\bin\x64_Debug\window.abi.lib"
copy "%GUI%\bin\x64_Debug\*.dll" .the .lib | only tells the linker the names, it has none of the code |
the .dll | is the code, and it has to sit beside your exe or it will not start |
you should see abi and a number, then all good