// Automatically generated C++ file on Wed Feb 4 16:36:39 2026 // // To build with Digital Mars C++ Compiler: // // dmc -mn -WD my_first_block.cpp kernel32.lib 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 #undef CLK static bool clk_state = false; static double Z1 = 0.0; static double Z2 = 0.0; static double A0 = -0.5; static double A1 = 0.9; extern "C" __declspec(dllexport) void my_first_block(void **opaque, double t, union uData *data) { double IN = data[0].d; // input bool CLK = data[1].b; // input double &OUT = data[2].d; // output if (CLK == false || CLK != clk_state) goto end; //*----------------------------------*/ OUT = IN - Z1 * A0 - Z2 * A1; Z2 = Z1; Z1 = OUT; //*----------------------------------*/ end: clk_state = CLK; // Implement module evaluation code here: }