Althor
3rd July 2010, 17:50
Hi!
I am learning to create a DLL which will be used from no-qt apps and I have a doubt.
My dll has only a cpp file:
#include <iostream>
using namespace std;
void hello3() {
cout << "!!!Hello World 3!!!" << endl; // prints !!!Hello World!!!
}
void hello2() {
cout << "!!!Hello World 2!!!" << endl; // prints !!!Hello World!!!
}
If I build the dll with that cpp file then my dll exports the following symbols:
_CRT_MT
_Z6hello2v
_Z6hello3v
_get_output_format
It exports all the functions inside the dll.
But if I add export declaration to one of my functions
void hello3() {
cout << "!!!Hello World 3!!!" << endl; // prints !!!Hello World!!!
}
extern "C" __declspec(dllexport) void hello2() {
cout << "!!!Hello World 2!!!" << endl; // prints !!!Hello World!!!
}
then my dll exports only the symbol:
hello2
It only exports the functions I have delcared explicitily as exported. Why??
Finally, if I add the 'extern "C"' to all my functions
extern "C" void hello3() {
cout << "!!!Hello World 3!!!" << endl; // prints !!!Hello World!!!
}
extern "C" void hello2() {
cout << "!!!Hello World 2!!!" << endl; // prints !!!Hello World!!!
}
then the symbols exported are:
_CRT_MT
_get_output_format
hello2
hello3
I don´t understand why qt has this behaviour.
Can you help me?
Regards.
I am learning to create a DLL which will be used from no-qt apps and I have a doubt.
My dll has only a cpp file:
#include <iostream>
using namespace std;
void hello3() {
cout << "!!!Hello World 3!!!" << endl; // prints !!!Hello World!!!
}
void hello2() {
cout << "!!!Hello World 2!!!" << endl; // prints !!!Hello World!!!
}
If I build the dll with that cpp file then my dll exports the following symbols:
_CRT_MT
_Z6hello2v
_Z6hello3v
_get_output_format
It exports all the functions inside the dll.
But if I add export declaration to one of my functions
void hello3() {
cout << "!!!Hello World 3!!!" << endl; // prints !!!Hello World!!!
}
extern "C" __declspec(dllexport) void hello2() {
cout << "!!!Hello World 2!!!" << endl; // prints !!!Hello World!!!
}
then my dll exports only the symbol:
hello2
It only exports the functions I have delcared explicitily as exported. Why??
Finally, if I add the 'extern "C"' to all my functions
extern "C" void hello3() {
cout << "!!!Hello World 3!!!" << endl; // prints !!!Hello World!!!
}
extern "C" void hello2() {
cout << "!!!Hello World 2!!!" << endl; // prints !!!Hello World!!!
}
then the symbols exported are:
_CRT_MT
_get_output_format
hello2
hello3
I don´t understand why qt has this behaviour.
Can you help me?
Regards.