I have one Visual Studio solution which consists of two win32 projects: 1) application (.exe) 2) functions wrapper (.dll).
The solution is in prototyping stage so all classes/functionality are implemented under (.exe) project - dirty but quick and easy for debugging/testing.
I've started to write a DLL wrapper to "play" with functionality in MSExcel/VBA and faced linking error
error LNK2019: unresolved external symbol "public: __thiscall Date::Date(int,int,int)" (??0Date@@QAE@HHH@Z) referenced in function addNumbers
DLL header file:
#ifdef LIBRARYWRAP_EXPORTS
#define LIBRARYWRAP_API __declspec(dllexport)
#else
#define LIBRARYWRAP_API __declspec(dllimport)
#endif
LIBRARYWRAP_API int _stdcall addNumbers(int a, int b);
DLL source file:
#include "..\applicationProject\Date.h"
class Date;
LIBRARYWRAP_API int _stdcall addNumbers(int a, int b){
Date dummyDate(12,1,2014); // <- Linker error LNK2019.
return (a+b);
}
Class Date
and constructor Date::Date(int,int,int)
are defined in application project(.exe) within Date.h
, Date.cpp
.
What I've tried to do already:
for librarywrap project added new reference.
Project -> Properties -> Common -> Add New Reference
. Selected "applicationProject".added additional include directories:
$(SolutionDir)\applicationProject
Two questions:
First, Is that legal/achievable what I'm trying to do? DLL links to application project, whereas usually it should be other way round - application links to DLL. Hypothetically if i have two application projects (.exe) & (.exe) will it be possible to link one to another?
Second, If answer for first question is positive what should I add/change to make it work?
Thanks very much!
Nicholas