Debug/release libs

B

Boni

Dear all,

I have following problem. I created a static libruary (mylib.lib).

I compiled it with Multithreaded DLL runtime in release mode. Now I want to
give out this library. But users who use it should be able to debug their
programs (i.e. compile their programs in debug mode Multithreaded DLL DEBUG
runtime ).

But at link time following warning is shown and prog crashes. Do I have to
give out both debug and release?

Thanks a lot,

Boni

LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
libs; use /NODEFAULTLIB:library
 
B

Bruno van Dooren

I have following problem. I created a static libruary (mylib.lib).
I compiled it with Multithreaded DLL runtime in release mode. Now I want
to give out this library. But users who use it should be able to debug
their programs (i.e. compile their programs in debug mode Multithreaded
DLL DEBUG runtime ).

But at link time following warning is shown and prog crashes. Do I have to
give out both debug and release?

Thanks a lot,

Boni

LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other
libs; use /NODEFAULTLIB:library

If your program allocates memory that is deleted by the user application,
then yes.
This memory allocation can also happen through use of stl parameters and
things like that.

In that case you need to supply 2 libraries to save your users form having
to jump through hoops.
still, in that case you still have the problem that your users need to use
the same compiler version that you used for building the library.

--

Kind regards,
Bruno.
(e-mail address removed)
Remove only "_nos_pam"
 
C

Carl Daniel [VC++ MVP]

Boni said:
Dear all,

I have following problem. I created a static libruary (mylib.lib).

I compiled it with Multithreaded DLL runtime in release mode. Now I
want to give out this library. But users who use it should be able to
debug their programs (i.e. compile their programs in debug mode
Multithreaded DLL DEBUG runtime ).

But at link time following warning is shown and prog crashes. Do I
have to give out both debug and release?

You should, yes.

Alternatively, you can compile your code with /Zl to omit the default
library specification from the resulting .obj files (and hence, from the
..lib file). If you've compiled a release build with /Zl, your users should
be able to link against it in both debug and release builds.

-cd

PS: http://msdn2.microsoft.com/en-us/library/f1tbxcxh.aspx
 
B

Boni

Dear Carl,
if I compile with /ZI user gets following error.
Alternatively, you can compile your code with /Zl to omit the default
library specification from the resulting .obj files (and hence, from the
.lib file). If you've compiled a release build with /Zl, your users
should be able to link against it in both debug and release builds.
Linking...
LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/CLRIMAGETYPE'
specification
mylib.lib(eng.obj) : error LNK2028: unresolved token (0A000006) "extern "C"
void __clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$J0YMXP6MXPAX@Z0@Z) referenced in function "void
__cdecl `anonymous namespace'::ReportErr(class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >,class
std::basic_string<char,struct std::char_traits<char>,class
std::allocator<char> >)"
(?ReportErr@?A0x7e8edfa5@@$$FYAXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z)
mylib.lib(params.obj) : error LNK2001: unresolved external symbol
"?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ)
mylib.lib(eng.obj) : error LNK2001: unresolved external symbol
"?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ)
....
Debug/fft_flpt.exe : fatal error LNK1120: 5 unresolved externals
 
C

Carl Daniel [VC++ MVP]

Boni said:
Dear Carl,
if I compile with /ZI user gets following error.

It looks like you've compiled your test library with /clr and your test
program without /clr, or something like that. I haven't tried using /Zl for
a long time - it's possible that it's no longer usable to build a
debug/release agnostic library as well.

-cd
 
B

Boni

Dear Carl ,
if I deploy debug build without pdb it is not easier to crack than release
build, isn't it. Im I right that all debug symbols are in pdb.
 
C

Carl Daniel [VC++ MVP]

Boni said:
Dear Carl ,
if I deploy debug build without pdb it is not easier to crack than release
build, isn't it. Im I right that all debug symbols are in pdb.

All debug symbols are in the PDB, yes. That said, debug builds are
considerably easier to reverse engineer than release builds due to the lack
of optimization.

-cd
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top