lilburne said:
Siemel Naran wrote:
Probably some weirdness in the linker too to make it work
across libraries.
I think the reason is that I compiled my library parse.lib in debug mode
into a debug lib file. Then I compiled my example.exe, and linked against
the debug parse.lib file, and I was therefore able to put breakpoints in the
inline function. Had I linked against the release parse.lib file, that
would probably not have been the case.
In the past, I found that creating a release parse.lib file, then compiling
example.exe in debug mode and linking against the release parse.lib file
caused my program to mysteriously crash at runtime. The reason I think is
that the class headers of the parse library define STL member variables,
like std::string, std::deque, etc. The parse.lib compiled in release mode
links against the release STL files, performs various compiler
optimizations, etc. My example.cpp includes the same headers, but compiles
in debug mode, so it does not do various optimizations, assumes that the
parse.lib file will link against the debug STL files, etc. So if both
parse.lib and example.exe are compiled in release mode, or both in debug
mode, then it works fine.
When I get more time, I'm going to use the pointer to implementation idea,
and define a nested struct Imp, and define it with all the STL member
variables in the cpp file. This might allow me to compile and run a debug
example.exe linked against a debug parse.lib.