On Mon, Nov 17, 2014 at 10:36:48AM +0100, Gustaf Neumann wrote:

> The problem is not a argument-passing or memory problem,
> but seems to be a linking problem. When a file is opened in a
> module (here nslog) only this module can write successfully
> to this file. Under Windows other dlls can't write to it, even
> when they write to the same fd. It seems to me as if the
> nslog dll is linked to a private runtime environment.

Very interesting!  Good detective work, Gustaf.

> Andrew, can you compare the linking options for nslog with these
> from Maurizio?

I don't know what link options Maurizio is using.

On Mon, Nov 17, 2014 at 01:05:28PM +0100, Gustaf Neumann wrote:

> that's a very good hint: AFIKT, all the modules used already the
> same /M* options. However, i've changed the runtime library
> option from /MT* to MD* (multi-threaded version) and a quick
> test (fildes to windows handle conversion) indicates that
> the strange behavior is gone.

We've been using /MTd (or plain /MT for non-debug builds) for
everything, because that's what was in the include/Makefile.win32
Ibrahim sent me, which was identical to the version in Mercurial last
touched by Vlad Seryakov back in 2007.

>From Microsoft's docs:

  http://msdn.microsoft.com/en-us/library/2kzt1wy3%28v=vs.110%29.aspx
  http://support.microsoft.com/kb/140584/en-us

  "/MT" is the "multithread, static version"
  "/MD" is the "multithread- and DLL-specific version"

Microsoft warns about mixing two different versions of the run-time
library, but says nothing about the mysterious file IO behavior we saw
with /MTd.  I looked through my three hardcopy books on Windows system
programming and found nothing relevant there either.

The most useful discussion I found of /MT vs. /MD (although still not
at all complete) was here:

  http://stackoverflow.com/questions/757418/should-i-compile-with-md-or-mt

It sounds like /MDd is the right default for Naviserver's Windows builds.
I haven't tried that or updated to Gustaf's latest code yet, but will
do so soon.

I'm compiling and running Naviserver on the same machine anyway, so
/MD should be completely fine for my use.  From the discussion above,
it sounds like someone distributing compiled binaries to run on other
machines MIGHT prefer to use /MT to simplify their application install
process, but even there /MD is still probably the correct default.

-- 
Andrew Piskorski <a...@piskorski.com>

------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to