This is note on how to create and modify a custom DLL component using the Proteus VSM API with Visual Studio (C++). This is one of the many several ways to create custom simulation part for proteus. Other methods include custom proteus part model creation using spice model, custom proteus part creation using .MDF model and graphical modelling.
A new DLL C++ project was created in Visual Studio 2026. Then a new C++ file was created and named as custompart.cpp. Then the vsm.hpp header file was put into the same location of the component custompart.cpp file. From within the Visual Studio, the vsm.hpp file was added to the project. If you need the proteus vsm.hpp file, you can download from the link below.
Proteus vsm.hpp file | download free
As can be seen in the screenshot below, the newly created project has default files dllmain.cpp, pch.cpp and framework.h, pch.h header files.
Here is the summary of the created files.
The code I used for simple .dll component:
#include "pch.h" #include <windows.h> #include <stdio.h> #include <math.h> #include "vsm.hpp" class my_device : public IACTIVEMODEL { private: ICOMPONENT* dcomponent; public: my_device() : dcomponent(NULL) {} virtual VOID initialize(ICOMPONENT* cpt) override; virtual ISPICEMODEL* getspicemodel(CHAR* primitive) override; virtual IDSIMMODEL* getdsimmodel(CHAR* primitive) override; virtual VOID plot(ACTIVESTATE state) override; virtual VOID animate(INT element, ACTIVEDATA* newstate) override; virtual BOOL actuate(WORD key, INT x, INT y, DWORD flags) override; }; // --- DLL Export Functions --- extern "C" __declspec(dllexport) IACTIVEMODEL* createactivemodel(CHAR* device, ILICENCESERVER* ils) { return new my_device(); } extern "C" __declspec(dllexport) VOID deleteactivemodel(IACTIVEMODEL* model) { delete (my_device*)model; } // Batch mode model creation entry points required by Proteus VSM extern "C" __declspec(dllexport) IACTIVEMODEL* createdevice(CHAR* device, ILICENCESERVER* ils) { return createactivemodel(device, ils); } extern "C" __declspec(dllexport) VOID deletedevice(IACTIVEMODEL* model) { deleteactivemodel(model); } // --- Implementation --- VOID my_device::initialize(ICOMPONENT* cpt) { dcomponent = cpt; ///*if (dcomponent) { // dcomponent->repaint(TRUE); //}*/ } ISPICEMODEL* my_device::getspicemodel(CHAR* primitive) { return NULL; } IDSIMMODEL* my_device::getdsimmodel(CHAR* primitive) { return NULL; } VOID my_device::plot(ACTIVESTATE state) {} VOID my_device::animate(INT element, ACTIVEDATA* newstate) { if (!dcomponent) return; dcomponent->drawsymbol(-1); dcomponent->drawsymbol(0); // Set colors before drawing dcomponent->setpencolour(WHITE); dcomponent->drawcircle(1, 1, 800); // Set text color to Red dcomponent->settextcolour(RED); dcomponent->drawtext(1, 1, 0, 2, (CHAR*)"Helloworld"); } BOOL my_device::actuate(WORD key, INT x, INT y, DWORD flags) { return FALSE; }
This code successfully compiled and dll file was produced.
The dll file was copied into the proteus model folder in the newly proteus version 9.1 SP2 which is located in the program data folder. Then to attach the dll file to the simulation schematic part, a new component part was drawn using the component block and with pins(or the make device process will throw error). The make device was used to attach the dll file using the MODDLL option and also required is to set PRIMITIVE to ACTIVE. Then the newly created dll simulation part is saved in the library and is ready to be used. But when the part was simulated there was no animation.
After research using AI chats like proteus propilot AI assistant(Gemini 3.6 was set as the LLM provider) and also cross checking with Claude AI, they suggested that the dll file must be compiled using x84 and not x64. When I created a new dll project in visual studio 2026, th project was created with x64 by default.
However it was easy to produce x84 dll version from the same project. There is a x84 or x64 selection option on the toolbar and recompilation was needed. I produced x84 dll version for the simulation and put into both proteus v8.17(which i had already) model folder and unto the proteus v9.1 model folder. When the simulation was run, there was error of not finding the correct file.
After researching further, a proteus vsm guide stated that the models must be placed inside the proteus v9 model folder because proteus 9.0 is 64-bit window application. This aligned with that the x64 version dll model did not throw error but there was simply no animation(resize,color etc was tried), which hinted that the animate function in the app code did not work. It also meant that the proteus AI and Gemini and Claude AI did not know about this.
That's all on this note on working with new dll component creation in proteus v.9.1.
See also Interactive Proteus VSM DLL Model Interface VSM C++ API Explorer.