CiaranWelsh
CiaranWelsh

Reputation: 7691

Why are `malloc` and `free` listed as `External` and `UNDEF` in DUMPBIN.exe output for my static library?

I have built a static library on Linux with gcc compilers using cmake and am now porting to windows with msvc compilers. I'm using CLion with the default generator, which is NMakefiles x64. I have managed to get my library to build without errors, but when I try to run any code from the library, the program just crashes. In attempt to debug I'm using dumpbin.exe to find the names of functoins that are missing in the COFF table.

> dumpbin /symbols .\redland-combined.lib | findstr "UNDEF"

gives me a long list of UNDEF symbols. Here's an excerpt

...
093 00000000 UNDEF  notype       External     | raptor_xml_namespace_uri
012 00000000 UNDEF  notype ()    External     | free
013 00000000 UNDEF  notype ()    External     | malloc
014 00000000 UNDEF  notype ()    External     | raptor_namespaces_start_namespace
015 00000000 UNDEF  notype ()    External     | raptor_new_namespace
018 00000000 UNDEF  notype ()    External     | raptor_librdfa_rdfa_iri_get_base
01A 00000000 UNDEF  notype ()    External     | raptor_librdfa_rdfa_create_mapping
01B 00000000 UNDEF  notype ()    External     | raptor_librdfa_rdfa_copy_mapping
01C 00000000 UNDEF  notype ()    External     | raptor_librdfa_rdfa_update_mapping
01D 00000000 UNDEF  notype ()    External     | raptor_librdfa_rdfa_free_mapping
01E 00000000 UNDEF  notype ()    External     | raptor_librdfa_rdfa_create_list
01F 00000000 UNDEF  notype ()    External     | raptor_librdfa_rdfa_replace_list
020 00000000 UNDEF  notype ()    External     | raptor_librdfa_rdfa_pop_item
021 00000000 UNDEF  notype ()    External     | raptor_librdfa_rdfa_free_list
022 00000000 UNDEF  notype ()    External     | raptor_librdfa_rdfa_replace_string
026 00000000 UNDEF  notype ()    External     | memset

Some of the symbols listed are a part of the library I'm tryng to build while others are from dependency libraries. All of this confuses me because I've double and triple checked that the include paths and link libraries are accurate - besides, shouldn't we get a compile/linker error if these were inaccurate? What I'm most confused about is the presence of the likes of malloc and free in there. What do I need to do to convert the label here in this table for malloc from EXTERNAL to STATIC?

Upvotes: 0

Views: 186

Answers (0)

Related Questions