Re: Strange linker errors (LNK2005) in Release build only .... why ??
- From: "Nanda" <nandagopal.seshagiri@xxxxxxxxx>
- Date: Fri, 11 Nov 2005 15:13:02 +0800
There is way, "dont use c-runtime library". If the number of trivial CRT
function u need are less then it is quite possible, as sometimes there are
typical win32 wrappers for certain functions.
nanda
"Krishnan R.S." <rskrishnan@xxxxxxxxxxx> wrote in message
news:eCwmjEi5FHA.3976@xxxxxxxxxxxxxxxxxxxxxxx
> So is there no way to override/replace malloc/free with my implementation
in
> a dll ??
>
> Thanks,
> Krishnan
>
> "Nanda" <nandagopal.seshagiri@xxxxxxxxx> wrote in message
> news:eTkBJbe5FHA.884@xxxxxxxxxxxxxxxxxxxxxxx
> > Hi,
> >
> > U are seeing this problem only in release build because, in debug, the
> free
> > and malloc are exported or used as _free_dbg and _malloc_dbg from
> > msvcrt70d.dll, where as in release they are exported as free and malloc.
> >
> > nanda
> >
> > "Krishnan R.S." <rskrishnan@xxxxxxxxxxx> wrote in message
> > news:%23$H7jjV5FHA.3636@xxxxxxxxxxxxxxxxxxxxxxx
> > > Hello All,
> > >
> > > First off I'd like to say I am not mixing the static and dll
> versions
> > of
> > > the runtime in my dll - I use /MDd for the debug and /MD for the
release
> > > versions of DLMAlloc.dll. I tried all sorts of options for the linker
> but
> > it
> > > seems adamantly stuck on not building the release version alone!
> > >
> > > I've got a project where I'm trying to use dlmalloc.c instead of
the
> > > usual vc7 malloc() - i.e. I want to build a drop in replacement for
the
> > > default vc7 malloc() allocator. To use this allocator in all my dlls I
> > need
> > > to build this as a separate dll - called say DLMalloc.dll.
> > >
> > > I've attached a zip file containing the source + the vcproj files
if
> > you
> > > are interested ...
> > >
> > > I have a project in MSVC 7.1 setup to build a dll (not a static
> lib) -
> > > all seems fine in the debug build. I am able to build my DLMalloc.dll,
> and
> > > DLMalloc.lib - and use it to build my app, successfuly links and works
> > too!
> > >
> > > The problem comes when I try to build a release build of
> > > DLMalloc.dll/DLMalloc.lib. The compile goes fine - but I get a linker
> > error.
> > > The linker thinks that _free and _malloc are defined multiple times -
> why
> > ??
> > >
> > > Why do I get this symbol conflict only on release builds ? I
suspect
> > that
> > > the MSVCR71.dll has internally linked to the malloc/free
implementations
> > > available in the runtime - is that possible ?? If so why does it work
> on
> > > the debug build ??
> > >
> > > I tried switching to incremental linking on the release build
(using
> > > /OPT:NOREF /OPT:NOICF with /INCREMENTAL) but no luck whatsoever.
> > > I tried looking at the verbose output of the linker - and it seems
> > like
> > > the reference to free is from crtdll.obj - see snippet below.
> > >
> > > ---snippet from the verbose linker output ---
> > > Found __imp__free
> > > Referenced in MSVCRT.lib(crtdll.obj)
> > > Loaded MSVCRT.lib(MSVCR71.dll)
> > > MSVCRT.lib(MSVCR71.dll) : error LNK2005: _free already defined in
> > malloc.obj
> > > --- end snippet ----
> > >
> > > I may very well be on the wrong track with my diagnosis ....
> > > I'd appreciate any help you can give me on this issue.
> > >
> > > Thanks,
> > > Krishnan
> > >
> > >
> > >
> > >
> > >
> >
> >
>
>
.
- Follow-Ups:
- Re: Strange linker errors (LNK2005) in Release build only .... why ??
- From: Krishnan R. S.
- Re: Strange linker errors (LNK2005) in Release build only .... why ??
- References:
- Prev by Date: Re: Strange linker errors (LNK2005) in Release build only .... why ??
- Next by Date: Re: Strange linker errors (LNK2005) in Release build only .... why ??
- Previous by thread: Re: Strange linker errors (LNK2005) in Release build only .... why ??
- Next by thread: Re: Strange linker errors (LNK2005) in Release build only .... why ??
- Index(es):
Relevant Pages
|