// Automatically generated C++ file on Tue Sep 29 21:31:50 2026 // // To build with Digital Mars C++ Compiler: // // dmc -mn -WD -o dllex.cpp kernel32.lib #include extern "C" __declspec(dllexport) void (*bzero)(void *ptr, unsigned int count) = 0; union uData { bool b; char c; unsigned char uc; short s; unsigned short us; int i; unsigned int ui; float f; double d; long long int i64; unsigned long long int ui64; char *str; unsigned char *bytes; }; // int DllMain() must exist and return 1 for a process to load the .DLL // See https://docs.microsoft.com/en-us/windows/win32/dlls/dllmain for more information. int __stdcall DllMain(void *module, unsigned int reason, void *reserved) { return 1; } // #undef pin names lest they collide with names in any header file(s) you might include. #undef in #undef out struct sDLLEX { // declare the structure here }; extern "C" __declspec(dllexport) void dllex(struct sDLLEX **opaque, double t, union uData *data) { double in = data[0].d; // input double &out = data[1].d; // output if(!*opaque) { *opaque = (struct sDLLEX *) malloc(sizeof(struct sDLLEX)); bzero(*opaque, sizeof(struct sDLLEX)); } struct sDLLEX *inst = *opaque; // Implement module evaluation code here: out = in > 0 ? in : -in; } extern "C" __declspec(dllexport) void Destroy(struct sDLLEX *inst) { free(inst); }