Click here to Skip to main content
15,908,775 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: communication from library to application Pin
utcode21-Mar-24 16:42
utcode21-Mar-24 16:42 
AnswerRe: communication from library to application Pin
Richard MacCutchan21-Mar-24 22:55
mveRichard MacCutchan21-Mar-24 22:55 
GeneralRe: communication from library to application Pin
utcode22-Mar-24 20:53
utcode22-Mar-24 20:53 
GeneralRe: communication from library to application Pin
Richard MacCutchan22-Mar-24 22:57
mveRichard MacCutchan22-Mar-24 22:57 
GeneralRe: communication from library to application Pin
utcode24-Mar-24 12:31
utcode24-Mar-24 12:31 
GeneralRe: communication from library to application Pin
Dave Kreskowiak24-Mar-24 15:29
mveDave Kreskowiak24-Mar-24 15:29 
GeneralRe: communication from library to application Pin
Richard MacCutchan24-Mar-24 22:26
mveRichard MacCutchan24-Mar-24 22:26 
QuestionWhats reason of error: LNK2019 unresolved external symbol "__declspec(dllimport) public: __cdecl NS::A::A Pin
Oscar K.16-Mar-24 19:58
Oscar K.16-Mar-24 19:58 
//TestDll2.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl NS::A::A(int (__cdecl*)(class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >))" (__imp_??0A@NS@@QEAA@P6AHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z@Z) referenced in function main

=====file TestDll2.cpp=====
C++
#include <iostream>
#include "..\\MyDll\\MyDll.h"

using namespace std;
using namespace NS;

int Print(string str);
int main()
{
  NS::A* a = new NS::A(Print);
  NS::printDlgt("Hello World!"); 
}

int Print(string str)
{
  cout << str << endl;
  return 0;
}
MyDll project files
=====MyDll.cpp=====
C++
#include "pch.h"
#include "MyDll.h"
namespace NS
{
  PrintDelegate printDlgt;
  A::A(PrintDelegate print_Dlgt)
  {
    NS::printDlgt = print_Dlgt;
  }
}

=====MyDll.h=====
C++
#include <iostream>
#ifndef MYDLL_H
#define MYDLL_H

//MYDLL_EXPORTS is set in C++\Preprocessor
#ifdef MYDLL_EXPORTS
#define MYDLL_API __declspec(dllexport)
#else
#define MYDLL_API __declspec(dllimport)
#endif


using namespace std;
typedef int (*PrintDelegate)(string str);

namespace  NS
{
  extern PrintDelegate printDlgt;
  class MYDLL_API A
  {
  public:
     A(PrintDelegate print_Dlgt);
  };
}
#endif

AnswerRe: Whats reason of error: LNK2019 unresolved external symbol "__declspec(dllimport) public: __cdecl NS::A::A Pin
Richard MacCutchan16-Mar-24 22:50
mveRichard MacCutchan16-Mar-24 22:50 
GeneralRe: Whats reason of error: LNK2019 unresolved external symbol "__declspec(dllimport) public: __cdecl NS::A::A Pin
Oscar K.17-Mar-24 2:53
Oscar K.17-Mar-24 2:53 
GeneralRe: Whats reason of error: LNK2019 unresolved external symbol "__declspec(dllimport) public: __cdecl NS::A::A Pin
Richard MacCutchan17-Mar-24 3:28
mveRichard MacCutchan17-Mar-24 3:28 
GeneralRe: Whats reason of error: LNK2019 unresolved external symbol "__declspec(dllimport) public: __cdecl NS::A::A Pin
Oscar K.17-Mar-24 5:45
Oscar K.17-Mar-24 5:45 
GeneralRe: Whats reason of error: LNK2019 unresolved external symbol "__declspec(dllimport) public: __cdecl NS::A::A Pin
Richard MacCutchan17-Mar-24 6:56
mveRichard MacCutchan17-Mar-24 6:56 
GeneralRe: Whats reason of error: LNK2019 unresolved external symbol "__declspec(dllimport) public: __cdecl NS::A::A Pin
Oscar K.17-Mar-24 23:36
Oscar K.17-Mar-24 23:36 
QuestionZonal Id Pin
john563214-Mar-24 0:51
john563214-Mar-24 0:51 
QuestionRe: Zonal Id Pin
CPallini14-Mar-24 2:09
mveCPallini14-Mar-24 2:09 
AnswerRe: Zonal Id Pin
john563214-Mar-24 2:52
john563214-Mar-24 2:52 
GeneralRe: Zonal Id Pin
CPallini14-Mar-24 3:08
mveCPallini14-Mar-24 3:08 
Questionjava Pin
Aryan Gupta 202413-Mar-24 11:20
Aryan Gupta 202413-Mar-24 11:20 
AnswerRe: java Pin
jeron113-Mar-24 11:26
jeron113-Mar-24 11:26 
AnswerRe: java Pin
CPallini13-Mar-24 21:44
mveCPallini13-Mar-24 21:44 
GeneralRe: java Pin
Aryan Gupta 202415-Mar-24 10:10
Aryan Gupta 202415-Mar-24 10:10 
GeneralRe: java Pin
CPallini16-Mar-24 1:44
mveCPallini16-Mar-24 1:44 
QuestionMy Visual Studio windows are all misplaced. Pin
Maximilien13-Mar-24 3:11
Maximilien13-Mar-24 3:11 
AnswerRe: My Visual Studio windows are all misplaced. Pin
Richard Andrew x6413-Mar-24 12:34
professionalRichard Andrew x6413-Mar-24 12:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.