Is there anybody who met with the issue below while trying to load the debug library aspose.pdf.cpp_vc_14x64d?
“ error: Debugger encountered an exception: Exception at 0x7ffd96076ac8, code: 0xc00000fd: stack_overflow, flags=0x0 (first chance)”
Is there anybody who met with the issue below while trying to load the debug library aspose.pdf.cpp_vc_14x64d?
“ error: Debugger encountered an exception: Exception at 0x7ffd96076ac8, code: 0xc00000fd: stack_overflow, flags=0x0 (first chance)”
If possible, could you please share the steps to reproduce such issue so that we can test the scenario in our environment and address it accordingly.
Hi,
I downloaded the library Aspose PDF C++ 25.5 for Windows from here: Download C++ PDF Library Create, Annotate, Edit | Aspose.PDF
When I use the 32-bit library in QT 5.15, there is no problem. But when I use 64-bit library in QT 6.9, I get the issue above while build and run. The expection stays on the LoadLibrary(…) line in qlibrary_win.cpp file. By the way, I am getting this issue in debug mode in QT. So there is no problem on release library “aspose.pdf.cpp_vc_14x64”.
Reproduced with:
Debugger encountered an exception: Exception at 0x7ffca613dcc5, code: 0xc0000374: , flags=0x81
For the release libraries versions, i.e.:
LIBS +=
-l"Aspose.PDF.Cpp_vc14x64"
-l"codeporting.translator.cs2cpp.framework_vc14x64"
And with:
Debugger encountered an exception: Exception at 0x7ffd96076ac8, code: 0xc00000fd: stack_overflow, flags=0x0
For the debug libraries version i.e.:
LIBS +=
-l"Aspose.PDF.Cpp_vc14x64d"
-l"codeporting.translator.cs2cpp.framework_vc14x64d"
Starting investigation.
@SANBAY
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFCPP-3389
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Hi, I will be waiting for your response.
@SANBAY
Regarding your question about the error
Exception at 0x7ffd96076ac8, code: 0xc00000fd: stack_overflow, flags=0x0" when linking with debug libraries.
which occurs when linking with debug libraries — the issue is related to the stack size.
You can increase the stack size by adding the following to your .pro
file:
contains(CONFIG, debug) {
QMAKE_LFLAGS += \
/STACK:"20485760,131072" /LARGEADDRESSAWARE
}
Alternatively, pass these flags to the linker in another way if you don’t use Qt Creator.
This sets the stack reserve size to 20 MB and the commit size to 128 KB, which should prevent the stack overflow in debug mode.
Regarding the other problem (links with release libraries) that I described above, it’s still under investigation.
Hi, I had already tried to increase stack size to 20MB, the error still exists.
@SANBAY
Are you using the same linker flags that I showed above?
i.e.
/STACK:"20485760,131072" /LARGEADDRESSAWARE
Yes, I did. Let me share the .pro file with you:
QT += gui charts printsupport core
TEMPLATE = lib
DEFINES += TCAL_LIBRARY
QMAKE_CXXFLAGS += /utf-8
CONFIG += c++17
#QMAKE_LFLAGS += /STACK:20485760,131072 # 20MB
contains(CONFIG, debug) {
QMAKE_LFLAGS +=
/STACK:“20485760,131072” /LARGEADDRESSAWARE
}
QMAKE_PROJECT_DEPTH = 0 #undocumented qmake flag to force absolute paths in make files
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/…/extLib/aspose_pdf/lib/ -lAspose.PDF.Cpp_vc14x64
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/…/extLib/aspose_pdf/lib/ -lAspose.PDF.Cpp_vc14x64d
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/…/extLib/aspose_pdf/lib/ -lcodeporting.translator.cs2cpp.framework_vc14x64
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/…/extLib/aspose_pdf/lib/ -lcodeporting.translator.cs2cpp.framework_vc14x64d
INCLUDEPATH += $$PWD/…/extLib/aspose_pdf/include
DEPENDPATH += $$PWD/…/extLib/aspose_pdf/include
INCLUDEPATH += $$PWD/…/extLib/aspose_pdf/CodePorting.Translator.Cs2Cpp_vc14_25.5/CodePorting.Translator.Cs2Cpp_vc14_25.5/include
DEPENDPATH += $$PWD/…/extLib/aspose_pdf/CodePorting.Translator.Cs2Cpp_vc14_25.5/CodePorting.Translator.Cs2Cpp_vc14_25.5/include
@SANBAY
Hmm… very interesting — it should work.
This link is a ZIP archive containing a demo project that uses Aspose.PDF for C++ v25.5, integrated with Qt Creator.
The project is configured to work correctly in both Debug and Release modes.
It generates a simple one-page PDF document and, for visual debugging purposes, prints a list of loaded DLLs. This helps confirm whether the Aspose.PDF Debug or Release libraries are being used, depending on the current build configuration.
Important: Debug and Release libraries must not be mixed — even when using /MD runtime mode — as they may rely on separate heap arenas, potentially leading to runtime errors.
It seems that Inside the .lib
file of Aspose PDF, there is a globally or statically defined structure (such as a SmartPtr pool, a StringManager, or a heap manager). This structure gets initialized during the DLL load process (i.e., when LoadLibrary()
is called), even before main()
starts.
It likely causes either a very deep recursion or rapidly consumes stack space during loading, which leads to a stack overflow error.
I should also note that I do not use Aspose PDF in a typical main()
executable as in your provided demo. Instead, I am integrating it into a custom DLL (TCal.dll
), which is then loaded by the main application.
Therefore, even if the demo application works fine in your case, this is not directly comparable to my usage.
In fact, I even tried a minimal main()
-based test on my side, and the stack overflow still occurred — simply linking the debug version of the Aspose .lib
is enough to trigger the error at LoadLibrary()
time, even without calling any Aspose code.
Yes, you are absolutely right in your assumption during the static initialization. We know about this problem and try to fix it in the next releases with postponed dynamic initialization.
But if I understand correctly, at this moment you using Aspose libraries in your application via your dll.
I created a simple project that does the same:
qt_console_app.exe links qt_proxy_dll.dll, (compile time or in runtime (see option:
# runtime or compile time linking with qt_proxy_dll.dll
RUNTIME_QT_PROXY_DLL_LINKING = NO
in qt_console_app.pro)) and call API from Aspose.PDF dll.
In booth project qt_console_app.pro and qt_proxy_dll.pro it require linker flags:
QMAKE_LFLAGS += \
/STACK:"20485760,131072" /LARGEADDRESSAWARE
in DEBUG configuration for both (exe and dll) project’s.
QT_PROJ_TEMP_via_proxy_dll.ZIP (4.1 KB)
Here is an attachment with an example.
My app has lots of custom dll’s. One of these dll’s uses aspose pdf c++ lib. If you say there will be no issue when I use wrapper as your example, I will try it. But I have to say that I cannot change or add any code in main.cpp in exe. I can only do this in the custom dll’s source code.
We’ve fixed the initialization issue, and the fix will be in the next update.
Let me know if there’s anything else I can help with!
When the next update will be released?