2013/10/25 Christopher Sean Morrison <[email protected]>:
> That said, it's still concerning that /MT doesn't work, though, since that
> should just cause a static C runtime to get linked... It should work.
For me it wasn't a big surprise. The C library implements malloc()
and free(). Usually these functions don't call the operating system
for every memory (de-)allocation. E.g. malloc() requests bigger
chunks from the OS and uses a static list to keep account of them.
Now, you have as many of these list in your program as instances of
the C library. If you request memory from one of these instances via
malloc() the other instances don't know about it. Therefore freeing
the memory there will fail.
> I would expect it to work unless there are system libs compiled against a
> different static C runtime because we should be compiling all the same.
If static C runtime works at all different versions doesn't matter.
I'm using this in my "own" programs which are usually compiled with
/MT. This way the modules (DLLs) could come from different sources.
But I need to take care of the memory management then. Corresponding
malloc(), realloc() and free() have to take place in the same binary.
> However, I think I just figured out what is going on. We wipe out the flags
> ... in CompilerFlags.cmake ... which is included in a NOT MSVC block in the
> top-level CMakeLists.txt file ... which means they're not being wiped out on
> Windows [0] like they needed to be. If we make them sync, I'd expect MT or
> MD to work and no platform conditionals are needed anywhere.
You shouldn't aim for wiping out the user's preferences. E.g. I
actively change them: /MD for the standard build und /MT for the
brlcad.dll. The global settings in CMake are a good way to adapt
BRL-CAD (or parts of it) to the needs of other programs. You should
only set/unset settings if you really need to. E.g. a shared core
library with static linked C library doesn't make sense. The likage
of the C library to static core libraries depends could keep a user
setting.
Regards,
Daniel
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel