I have one c++ project 'A' which outputs a dynamic library. I want this library to link to a static library 'B' that I made. The problem is that I am having an undefined external symbol
error on compile time.
I tried to configure 'B' as a dynamic library and the linking works fine, but the requirement is to have a dynamic library linking to a static library.
My questions are:
- What might be different between a static library and a dynamic library that might affect this type of linking?
- When using a static library should all the symbols that I want to use
dllexport
ed? If yes, why is it not necessary to do using when linking to dynamic library
EDIT
In B project I have the following:
Header file
#define APICALL extern "C" __declspec(dllexport)
#define STACKMODE __stdcall
APICALL void STACKMODE GenerateTIERJ_PAM4(double * timeVals, double * YVals, double * smoothedYVals, double lineRate, double ratio, double*tiePts, double * timeIndexes, double *RJ_RMS, int cntData);
Source file
APICALL void STACKMODE GenerateTIERJ_PAM4(double * timeVals, double * YVals, double * smoothedYVals, double lineRate, double ratio, double*tiePts, double * timeIndexes, double *RJ_RMS, int cntData)
{
//Doing some stuff
}
In A project I am using this function directly using
extern "C" __declspec(dllimport)void GenerateTIERJ_PAM4(double * timeVals, double * YVals, double * smoothedYVals, double lineRate, double ratio, double*tiePts, double * timeIndexes, double *RJ_RMS, int cntData);
When trying to use B as a dynamic library it works but when trying to use it as a static library I get the following
Error LNK2019 unresolved external symbol __imp_GenerateTIERJ_PAM4 referenced >in function "public: static double __cdecl >Filters::ProcessScopeSamplesForTIE