Page 1 of 2
critical error with my_element.dll
Posted: Mon 16 Mar 2026 10:35
by smorard
Dear Didier,
When running my project with my own element in the file my_element.dll, it works only the first try when TraceWin is starting. If I run it a few times because I changed some parameters or something I end up with an error message saying there is a critical error and TraceWin is becoming unstable, then it crash.
I encounter this problem since I'm using Windows, I didn't have this problem with this file under linux format '.so'.
Thanks in advance for your help.
Sophie
Re: critical error with my_element.dll
Posted: Mon 16 Mar 2026 13:50
by Didier
Dear Sophie,
I’ve made some improvements to the DLL format validation in Windows, and using your example, with the new version of TraceWin I now get the message “Is not a valid Win32 application.”
This probably means that the DLL has been built incorrectly or that it calls on 32-bit DLLs when it should be compiled as 64-bit. I can’t say for sure at this stage, but what is certain is that the DLL I provided as an example with the code works. So if you could send me the code for your DLL, I’ll try compiling it myself and perhaps I’ll be able to figure out the problem.
In first time upgrade TraceWin to check, if you have the same message.
Regards,
Didier
Re: critical error with my_element.dll
Posted: Mon 16 Mar 2026 14:50
by smorard
Dear Didier,
I don't have any new update available on TraceWin, so I can't test.
I don't remember how I compile the DLL first time so I did it again in 64-bits for sure. You can find the new version attached to this message.
Best regards,
Sophie
Re: critical error with my_element.dll
Posted: Mon 16 Mar 2026 16:17
by Didier
Dear Sophie,
I’ve further improved the detection of issues when loading Windows DLLs by adding dependency detection and checks to ensure they’re present. So, with the latest version of TraceWin (I’ve actually updated it on the website this time), I get the following message when using your DLL:
Code: Select all
Following error occurred :
'[my_elements.dll]
The specified module cannot be found.
libwinpthread-1.dll : Missing dll
From->[ELEMENTS] : My element envelope:Element :16
From->[Calc] : Ref particle transport'
One dll is missing': "libwinpthread-1.dll"
How did you compile it? Which compiler and which options did you use? Could you tell me your command line?
Re: critical error with my_element.dll
Posted: Tue 17 Mar 2026 08:53
by smorard
Dear Didier,
I used mingw64 to compile the file with these commands :
Code: Select all
g++ -m64 -Wall -c MAGNET_ELECTRO_BEND.cxx
g++ -m64 -Wall -c FENTE.cpp
g++ -m64 -shared -static-libgcc -static-libstdc++ -Wl,--export-all-symbols -o my_elements.dll MAGNET_ELECTRO_BEND.o FENTE.o
Re: critical error with my_element.dll
Posted: Tue 17 Mar 2026 09:52
by Didier
Dear Sophie,
I think it depends on your version of moingw64, and I suggest you try these two solutions:
- Add "-static" to the last line of your command
- Find "libwinpthread-1.dll" file and place it alongside your DLL
Regards,
Didier
Re: critical error with my_element.dll
Posted: Tue 17 Mar 2026 10:37
by smorard
Dear Didier,
I use the 15-2-0 version of mingw64.
I tried both solutions and it still doesn't seem to fully work, the critical error still appears randomly.
Regards,
Sophie
Re: critical error with my_element.dll
Posted: Tue 17 Mar 2026 10:56
by Didier
Dear Sophie,
As for me, I haven't encountered any critical errors !
Have you tried the latest version of TraceWin?
Could you send me you cpp file, I'll check that
Regards,
Didier
Re: critical error with my_element.dll
Posted: Tue 17 Mar 2026 13:06
by Didier
Dear Sophie,
Please try my own dll file
Regards,
Didier
Re: critical error with my_element.dll
Posted: Tue 17 Mar 2026 13:15
by smorard
Dear Didier,
Thank you for your file.
Indeed, I don't encounter an error with this one. Which version of MinGW do you use ?
Regards,
Sophie