Closed Bug 550401 Opened 15 years ago Closed 15 years ago

warning C4273: 'moz_strdup' : inconsistent dll linkage (string.h relating to mozalloc.h)

Categories

(Core :: XPCOM, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.9.3a5

People

(Reporter: Callek, Assigned: cjones)

References

Details

(Whiteboard: [build_warning])

Attachments

(1 file, 1 obsolete file)

C:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\string.h(207) : warning C4273: 'moz_strdup' : inconsistent dll linkage c:\programming\objectdirs\mozilla\trunk\suiterunnerdebug\mozilla\dist\include\mozilla/mozalloc.h(138) : see previous definition of 'moz_strdup' Per IRC with cjones, the issue is that the MSVC headers declare strdup as dllimport and we are dllexport.
Since this code has been working with dllexport, I would assume that MSVC treats undefined dllexport functions as dllimport at link time, which makes me question the usefulness of dllimport. But that's neither here nor there.
roughly you need a macro which results in DLL_EXPORT when used by mozalloc.cpp but DLL_IMPORT when included everywhere else. we have loads of macros for this.
Attached patch proposal (obsolete) — Splinter Review
Assignee: nobody → timeless
Status: NEW → ASSIGNED
Attachment #430584 - Flags: review?(benjamin)
Comment on attachment 430584 [details] [diff] [review] proposal +# ifdef MOZALLOC_DONT_DEFINE_MACRO_WRAPPERS +# define MOZALLOC_METHOD __declspec(dllexport) +# else +# define MOZALLOC_METHOD __declspec(dllexport) +# endif Pretty sure you meant one of this to be dllimport?
Attachment #430584 - Flags: review?(benjamin) → review-
Will that actually work with the system headers? Along with that fix you might need to wrap the system headers like the WinCE build does (see build/wince/shunt, iirc), to do things like #define strdup orig_strdup #include <sdk_dir/string.h> #undef strdup
wfm on windows and linux.
Assignee: timeless → jones.chris.g
Attachment #435804 - Flags: review?(benjamin)
bsmedberg, any chance of getting a quick review on this soonish? Windows devs seem to be waiting with bated breath.
Attachment #435804 - Flags: review?(benjamin) → review+
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Attachment #430584 - Attachment is obsolete: true
V.Fixed, per tinderbox. (See bug 558163, just in case.)
Status: RESOLVED → VERIFIED
Flags: in-testsuite-
Target Milestone: --- → mozilla1.9.3a5
Whiteboard: [build_warning]
Depends on: 564261
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: