[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: MSVC compiler support [patch 24]: strftime crash

From: michael . goffioul
Subject: RE: MSVC compiler support [patch 24]: strftime crash
Date: Thu, 26 Oct 2006 13:55:21 +0200

> For now, I have a special case in configure.in. Can you please checkto make
> sure that liboctave/strftime.c will compile on your system if
> HAVE_STRFTIME is not defined in config.h?
It does, but you have to add the following lines to oct-time.cc:

/* Just to be sure to override any previous definition and use local version */
extern "C" size_t strftime (char *s, size_t maxsize, const char *format, const struct tm *tp);

The reason is that without that definition, oct-time.o is somehow "bound" to
the MSVCRT.DLL implementation (I think this is due to the dllimport tag found
in the MSVC headers). The linker then fails because the local strftime clashes
with the one imported from MSVCRT.DLL. The lines above re-defines strftime
without the dllimport tag (you get a warning about it), but at least the linker does
not import the MSVCRT.DLL implementation.
Anyway, I think that C++ requires function declaration prior using it. So if a
system does not have strftime, such a declaration is needed, isn't it?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]