Opened 7 years ago

Closed 7 years ago

#11339 closed Bugs (fixed)

VC12 LNK2005 error with boost::container::adaptive_pool

Reported by: anonymous Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: container
Version: Boost 1.58.0 Severity: Problem
Keywords: Cc:

Description

Unfortunately I cannot reproduce it in a test project. The problem appears when a delayed load DLL is linked to the main app. The error is Delayimp.lib(delayhlp.obj) : error LNK2005: HRESULT_FROM_WIN32 already defined in libboost_container-vc120-mt-1_58.lib(alloc_lib.obj)

(Making the DLL non-delayed makes the error go away.) This seems to be related to unsetting the FORCEINLINE define in dlmalloc_ext_2_8_6.c (line 34). I am not sure it it was an intention but FORCEINLINE is also defined in windows headers and unsetting it un-inlines windows functions included in dlmalloc_2_8_6.c (line 544), e.g.

FORCEINLINE HRESULT HRESULT_FROM_WIN32(unsigned long x) { return (HRESULT)(x) <= 0 ? (HRESULT)(x) : (HRESULT) (((x) & 0x0000FFFF) | (FACILITY_WIN32 << 16) | 0x80000000);}

in winerror.h

Commenting out the line 34 in dlmalloc_ext_2_8_6.c fixes this but perhaps this define should have a different name, e.g. CONT_FORCEINLINE (?) Thanks.

Change History (1)

comment:1 by Ion Gaztañaga, 7 years ago

Resolution: fixed
Status: newclosed

Thanks for the report. Tried a fix in:

https://github.com/boostorg/container/commit/5d35aec80fd8c96181c7b0fb4c543fe18c6ee9a5

[develop 5d35aec] Fixed Trac #11339 ("VC12 LNK2005 error with boost::container::adaptive_pool")

2 files changed, 5 insertions(+), 1 deletion(-)

The macro could be deleted for all except GCC which does not like the default dlmalloc's definition

Note: See TracTickets for help on using tickets.