1

Yesterday I was helping a friend to compile Intel's MKL Java examples. We were having issues with "unresolved externals", even though everything seemed fine (accordingly to the example files / makefile).

I then used Visual Studio's dumpbin to check whether the unresolved functions were present in the library. One example of a unresolved external was a function called _cblas_sgemm. When dumping the symbols from the library (dumpbin /symbols mkl_core.lib), I was only able to find a function cblas_sgemm on the library, which missed the prefix _. I then discovered that the function actually was only called cblas_sgemm, and that the compiler added the _ prefix, as part of the name mangling rule.

TL;DR

So, my questions are:

  1. Does dumpbin displays the full name of the entry point in the library? Or for some reason it actually "unmangles" the name?
  2. The library came with the installation package, so I don't know which compiler was used to compile it. Does different compilers produce different names?

I don't really think I got it right; I'm probably doing something wrong somewhere else, but I want to be sure about those two questions.

A similar question with no answers is here.

Community
  • 1
  • 1
Bruno Brant
  • 8,226
  • 7
  • 45
  • 90

1 Answers1

2
  1. dumpbin will show the full name of symbol in the library(not in the source), without any alternation. For MS mangled of C++ names, it will show the original symbol in parenthesis (if it can figure out the original symbol). (tested with dumpbin 9.00.21022.08)

  2. Different compilers do generate different symbols, especially for C++ symbols. For symbols, compilers tend to have an agreement about name mangling, so extern "C" symbols can be linked between different compilers.

Here is an wikipedia article about name mangling.

fefe
  • 3,342
  • 2
  • 23
  • 45