Opened 13 years ago

Closed 13 years ago

#3090 closed Bugs (duplicate)

Include file_lock.hpp in two compilation units results in multiple definitions at link time (win32)

Reported by: jkp@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.39.0 Severity: Showstopper
Keywords: multiple definition symbol windows Cc:

Description

Including the file #include "boost/interprocess/sync/file_lock.hpp" from two seperate compilation units results in multiply defined symbols.

The reason is that the following symbols contain nested class definitions.

static inline bool unlink_file(const char *filename); static inline bool get_file_name_from_handle_function

(void * hFile, wchar_t *pszFilename, std::size_t length, std::size_t &out_length);

Moving the definitions for the functions to a source file and compiling that into the library instead solves the issue.

You can prove that the issue is the nested structs / classes by commenting out the function bodies.

This is a pretty serious issue since it pretty much means you cannot use boost interprocess under windows right now.

I'm compiling under MSVC8.1. The issue does not present itself under GCC, but then, these function implementations are win32 specific.

Attachments (1)

testcase.txt (1.5 KB ) - added by jkp@… 13 years ago.
Small test-case to illustrate the issue: compile the code into a dll using VS2005

Download all attachments as: .zip

Change History (3)

by jkp@…, 13 years ago

Attachment: testcase.txt added

Small test-case to illustrate the issue: compile the code into a dll using VS2005

comment:1 by jkp@…, 13 years ago

I have confirmed that this bug is confined to VS2005: in VS2008 the problem goes away. This is obviously a serious issue because it means anyone on VS2005 cannot use the library right now.

comment:2 by Steven Watanabe, 13 years ago

Resolution: duplicate
Status: newclosed

Duplicates #2992.

Note: See TracTickets for help on using tickets.