Search code examples
c++pe-exports

EXE exports static lib exports as well


I've created both a static lib and an EXE file (which uses the static lib), but when I open up the EXE in IDA pro, the exports are listed in the EXE as well.

I know they should be exported in the .lib itself, but why are they showing up as exports in the EXE too?

EDIT: Here is an export/import (they are in separate header files)

Here is the export:

#define NC_LIBEXPORT(a) extern "C" __declspec(dllexport) a __cdecl
NC_LIBEXPORT(VOID) rol8(unsigned char* a, unsigned char b);

and the import:

extern "C" VOID rol8(unsigned char* a, unsigned char b);

Solution

  • You need to make sure that when you build the static lib, you do not use __declspec(dllexport).

    If you want to use the same lib in a DLL and in your executable, and you don't want the executable to export the symbols, then you'll need to use a DEF file rather than __declspec(dllexport).