Linking statically to Havok

Linking statically to Havok

I'm starting a new thread for this, cause the "Legal question" thread got hijacked by accident.

Here's my problem:

I'm making a mixed assembly (C++/CLI and C#) and /clr compiler switch
requires Debug Multithreaded DLL standard libraries. Havok
debug_multithreaded libs are compiled with Debug Multithreaded Static
libs, so the linker complains.
Ignoring static default libraries
when linking with Havok (/NODEFAULTLIB:libc.lib
/NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:msvcrt.lib
/NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib) works, but I'm not
really sure if this is a "supported" scenario. I hope so, because it
seems to be the only way to hook Havok and C#.

And here's HavokDaveW's reply:

What exactly does the linker complain about? Are you trying compile a
dll version of the Havok libraries, and are you going to be releasing
your software with separate Havok dlls? Again, this does not sound
like a supported scenario.

So let me explain:

I'm not compiling Havok libs, I'm only using the tryhavok-free Win32 binaries. There are debug_multithreaded and debug_multithreaded_dll versions.
I have to link with Debug Multithreaded DLL runtime library, due to /clr usage.

So if I link with static Havok libs (releasing anything with dynamic Havok libs is illegal) I get this warning:
LINK : warning LNK4098: defaultlib 'LIBCMTD' conflicts with use of other libs; use /NODEFAULTLIB:library
Cause Havok is referencing static runtime library (libcmtd.lib) and my code references dynamic runtime library (msvcrtd.lib).
Using /NODEFAULTLIB works just fine, and even without it it compiles and works as expected.
I don't suppose it could cause any problems, but I just wanted to make sure.

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Okay, I understand now. So to address your concern, if you're not getting linker errors by ignoring libcmtd.lib, then you should be okay. Otherwise it would complain if Havok used any functionality from libcmtd.lib.

David W.

Leave a Comment

Please sign in to add a comment. Not a member? Join today