In my Windows build work, I'm getting a lot of warnings like this one:

  master.c(67) : warning C4273: 'Ns_MasterLock' : inconsistent dll linkage
     ..\include\nsthread.h(597) : see previous definition of 'Ns_MasterLock'

The definition is of course in nsthread/master.c, which starts like so:

  void Ns_MasterLock(void)

The declaration in include/nsthread.h is:

  NS_EXTERN void Ns_MasterLock(void);

include/ns.h has this:

  #define NS_EXTERN                  extern NS_EXPORT

But I believe that is NOT relevent here because master.c, thread.h,
and nsthread.h (correctly) do NOT include ns.h.

Instead, I think it is the separate definition of NS_EXTERN in
nsthread.h that matters when building nsthread.  The code there gets
pretty tricky.  Tracing the dependencies backwards, I THINK the
relevent bits are:

  #ifdef _WIN32
  # define NS_EXPORT                   __declspec(dllexport)
  # define NS_IMPORT                   __declspec(dllimport)

  # define NS_EXTERN                   extern NS_STORAGE_CLASS

  # if defined(NSTHREAD_EXPORTS)
  #  define NS_STORAGE_CLASS            NS_EXPORT
  # else
  #  define NS_STORAGE_CLASS            NS_IMPORT
  # endif

  #if defined(__GNUC__) || defined(__MINGW32__)
  #define NSTHREAD_EXPORTS
  #endif

AFAICT from reading that code, when using Microsoft's compiler
NSTHREAD_EXPORTS is never set, and thus NS_STORAGE_CLASS is never set
to NS_EXPORT, it is always set to NS_IMPORT and thus is wrong when
building nsthread.

Why is that checking which compiler was used anyway?  Is the correct
fix simply to set NSTHREAD_EXPORTS unconditionally regardless of the
compiler?

I tried that, and it DOES make the warning for Ns_MasterLock go away.
However, I do still have more serious build errors after that point,
and then additional "inconsistent dll linkage" warnings (for
Ns_ThreadCreate, etc.) despite that change, so I'm not yet entirely
convinced that I correctly diagnosed the problem.

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

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&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