How can i modify the code inside the .dll block in Qspice. I want to modify the block , i will add new inputs and outputs the block, but i want to retain the past code written inside the block. How can i do that? Creating new template erases everything.
I know i can copy the code somewhere and again paste it back.
Unfortunately, there’s not a single-step process. I usually do this:
Rename the C-Block in the schematic. For example if DLL name is MyCBlock (which produces MyCBlock.DLL), then rename it to MyCBlockX temporarily (again, in the schematic hierarchical block).
Generate the new DLL code (MyCBlockX.cpp)…
Change the name back to MyCBlock in the C-Block.
Open the C-Block code (MyCBlock.cpp) in the editor and open MyCBlockX.cpp in Notepad.
Copy/paste the #undefs and data[#] definitions from MyCBlockX.cpp to MyCBlock.cpp.
I suggest that you look into other IDEs so that you can have both open in the same editor for convenience. I use VSCode (free from Microsoft) to edit/compile. To compile, you’ll need to configure VSCode to use the DMC compiler or to use Microsoft’s VS C++ compiler. (Instructions are on my GitHub QSpice repository.
Note: There’s also a tool called QCodeGen on the repo that is intended to simplify regenerating code without overwriting. I’ve not tested it against the most recent versions of QSpice so it may be a bit out of date.