0

What static library should I use to link against to use the NormalizeString() function?

In contrast with most functions documented on MSDN, the static library required to use the function is not declared. I tried using the name derived from the DLL: normaliz.lib and it successfully linked, but then I get a pop-up at runtime saying Normalization.dll could not be found on my computer and the process is shut down.

André Caron
  • 44,541
  • 12
  • 67
  • 125
  • It is Normaliz.dll. Available only in Vista and up. If you intend to target XP then be sure to set the _WIN32_WINNT macro value properly so you'll get compile errors for functions that are not available in the target operating system. – Hans Passant Aug 14 '11 at 22:36
  • @Hans: Yes, I'm already checking ``_WIN32_WINNT``. I'm testing on Windows 7. – André Caron Aug 15 '11 at 02:03
  • Works fine when I try this on Windows 7. What version of the Windows SDK are you using? I tried it with 6.0, while debugging I see it implemented in kernel32.dll with RtlNormalizeString in ntdll.dll. Which makes the documentation subtly wrong, normaliz.lib instead of normaliz.dll – Hans Passant Aug 15 '11 at 09:32
  • @Hans: I've tried using both Windows SDK v6.0A and v7.0(something) on two Windows 7 machines. What static library are you linking against? – André Caron Aug 15 '11 at 13:21
  • Normaliz.lib, it won't link otherwise. It is not a static lib, it is an import lib. You need to find out where "normalization.dll" comes from. Use dumpbin.exe /imports – Hans Passant Aug 15 '11 at 13:26
  • @Hans: ran `dumpbin /imports myprogram.exe` and under `Normalization.dll`, only `Ordinal 1` shows up. Other DLLs, such as `KERNEL32.dll` actually list some known functions, such as `GetLastError()`. – André Caron Aug 15 '11 at 13:38
  • It is a named export in kernel32.dll, ordinal 881. The only thing that makes sense is that your linker is picking up a wrong import library. Add the /VERBOSE option to the linker command line settings to see what .libs it is loading. – Hans Passant Aug 15 '11 at 15:08
  • @HansPassant let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/2495/discussion-between-andre-caron-and-hans-passant) – André Caron Aug 15 '11 at 15:16

2 Answers2

1

As pointer out by Hans Passant, the correct import library is normaliz.lib. It seems there was some problem in my setup.

I was using Windows SDK v6.0A. After switching to Windows SDK v7.0A, my problems stopped.

André Caron
  • 44,541
  • 12
  • 67
  • 125
0

The link at the bottom-ish of the page you linked states that the download contains implib and dll resources. You probably have to manifest the dll, or at least put it into PATH.

bmargulies
  • 97,814
  • 39
  • 186
  • 310