The diary of the world's fastest, most flexible, and most robust C++ logging API library.
Showing posts with label Initialization. Show all posts
Showing posts with label Initialization. Show all posts
Sunday, February 14, 2010
LoadLibrary() and ERROR_NOACCESS
Further to my last post, if you muck up the initialisation and there's an access violation in your DLL, you'll likely see ERROR_NOACCESS from GetLastError() when LoadLibrary() fails.
Thursday, February 11, 2010
Don't forget to initialise the library!
I'm doing some work for an overseas client at the moment, on a Windows DLL that provides access to their business logic to Excel. We're working on tightening up the implementation, ready for product release.
Most of the work so far has been porting between C/C++ compilers, but one of the other things I'm doing is adding diagnostic logging, via Pantheios of course.
As it's been several months since I've plugged Pantheios into a DLL I've forgotten the significant issues:
Most of the work so far has been porting between C/C++ compilers, but one of the other things I'm doing is adding diagnostic logging, via Pantheios of course.
As it's been several months since I've plugged Pantheios into a DLL I've forgotten the significant issues:
- (By default) the Pantheios core is not initialised explicitly, meaning that DllMain() must call the functions pantheios_init() (if C) or pantheios::init() (if C++) to initialise the library (or handle the error and fail DllMain(), if it fails), and call pantheios_uninit() (if C) or pantheios::uninit() (if C++) to uninitialise (but only if the initialisation failed). (See instructions below for implicit initialisation in a DLL.)
- Global object constructors must not invoke logging facilities
- specify the pre-processor flag PANTHEIOS_FORCE_AUTO_INIT in your DLL's compilation
- have at least one C++ source file the DLL project includes pantheios/pantheios.hpp
Labels:
back-end,
Initialisation,
Initialization,
Pantheios
Subscribe to:
Posts (Atom)