Linker warnings in Debug x64 build /MT

c++ / delphi package - dll injection and api hooking
_NN_
Posts: 55
Joined: Mon Jan 21, 2013 4:00 pm

Linker warnings in Debug x64 build /MT

Post by _NN_ »

Debug x64 platform:
I have project with Multithreaded CRT (/MT not /MD).
The project compiled in Debug with the madCHook mt lib get following:

Code: Select all

1>LIBCMTD.lib(initializers.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
Another issue with Debug Win32 platform:

Code: Select all

1>madCHook32.lib(madCHook.obj) : warning LNK4202: spawning full build due to '/INCREMENTAL:NO' directive
1>madCHook.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
madshi
Site Admin
Posts: 10368
Joined: Sun Mar 21, 2004 5:25 pm

Re: Linker warnings in Debug x64 build /MT

Post by madshi »

I hate MSVC++, so many stupid linker problems. Are these warnings a real big problem, or is it just a cosmetical issue?
_NN_
Posts: 55
Joined: Mon Jan 21, 2013 4:00 pm

Re: Linker warnings in Debug x64 build /MT

Post by _NN_ »

If you switch from EditAndContinue to simple PDB and turn off incremental linking, there is no warning.
It just the project default ;)
madshi
Site Admin
Posts: 10368
Joined: Sun Mar 21, 2004 5:25 pm

Re: Linker warnings in Debug x64 build /MT

Post by madshi »

Ah I see, that should be easy enough! :)
madshi
Site Admin
Posts: 10368
Joined: Sun Mar 21, 2004 5:25 pm

Re: Linker warnings in Debug x64 build /MT

Post by madshi »

So here's a new test build:

http://madshi.net/madCollectionBeta.exe

It now contains 32bit static libs created with MSVC++ (2005). I didn't actually find a setting for "incremental linking", when creating lib files. The 32bit static lib you've been working with is created from the Delphi sources, by using some external conversion tools. Maybe those tools made it appear as if the static lib were built with "incremental linking"? I've no idea.

P.S: The new build also contains the new DLL injection method as an option. See USE_IAT_DLL_INJECTION. It requires your hook DLL to have an exported function, though, otherwise it won't work. And the biggest disadvantage: Uninjection no longer works, because the OS considers your hook DLL statically linked.
_NN_
Posts: 55
Joined: Mon Jan 21, 2013 4:00 pm

Re: Linker warnings in Debug x64 build /MT

Post by _NN_ »

Hello,
I tried the new libs and get a about 32 warnings in 32-bit build:

Such as:
madCHook32mt.lib : warning LNK4099: PDB 'vc80.pdb' was not found with 'madCHook32mt.lib(AtomicMove.obj)' or at 'bin\vc80.pdb'; linking object as if no debug info

Workaround advanced setting for linker: /ignore:4099


The original warning still present.
1>LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
Workaround: Use /NODEFAULTLIB:LIBCMT as described here.
https://docs.microsoft.com/en-us/cpp/er ... ew=vs-2017

UI
Image
madshi
Site Admin
Posts: 10368
Joined: Sun Mar 21, 2004 5:25 pm

Re: Linker warnings in Debug x64 build /MT

Post by madshi »

Do you get the same warnings when compiling the madCodeHook demo projects?
_NN_
Posts: 55
Joined: Mon Jan 21, 2013 4:00 pm

Re: Linker warnings in Debug x64 build /MT

Post by _NN_ »

Demo projects don't have Debug build configuration.
madshi
Site Admin
Posts: 10368
Joined: Sun Mar 21, 2004 5:25 pm

Re: Linker warnings in Debug x64 build /MT

Post by madshi »

True. Hmmmm... I'm not exactly sure what to do now, to be honest. MSVC++ with its countless compiler and linker incompatability issues like this is annoying the heck out of me.
_NN_
Posts: 55
Joined: Mon Jan 21, 2013 4:00 pm

Re: Linker warnings in Debug x64 build /MT

Post by _NN_ »

There are only few little issues which are not hard to solve.
As well there are workarounds for all of them except this one.
Perhaps you should add documentation page with all workarounds to not search the forum each time.
madshi
Site Admin
Posts: 10368
Joined: Sun Mar 21, 2004 5:25 pm

Re: Linker warnings in Debug x64 build /MT

Post by madshi »

Any suggestions on how to solve this one?
_NN_
Posts: 55
Joined: Mon Jan 21, 2013 4:00 pm

Re: Linker warnings in Debug x64 build /MT

Post by _NN_ »

The warning says that one or more of your files are compiled with a different flag.
For instance all files use /MT but one uses /MD.
Is it true ?
madshi
Site Admin
Posts: 10368
Joined: Sun Mar 21, 2004 5:25 pm

Re: Linker warnings in Debug x64 build /MT

Post by madshi »

A user requested a while ago that I provide both MT and MD builds. So I'm doing that (for the static libs created with MSVC++). The lib files have "MT" or "MD" in the file name. The file name should match how I created them (I hope).
_NN_
Posts: 55
Joined: Mon Jan 21, 2013 4:00 pm

Re: Linker warnings in Debug x64 build /MT

Post by _NN_ »

Check the initializers.cpp file. Perhaps something weird there.
Check with VS2017, the warning reproduces easily.
madshi
Site Admin
Posts: 10368
Joined: Sun Mar 21, 2004 5:25 pm

Re: Linker warnings in Debug x64 build /MT

Post by madshi »

"initializers.cpp"? I don't have such a file here.
Post Reply