Hi,
i have read the article in this site on how create ad using a custom DLL.
I have tried to reproduce the example and it works.
My problem now is that when i try to do the same thing for my need it doesn't works.
I try to be brief. Suppose we have this structure:
DLL project consists of this files.
A.h (we can also suppose that this file does nothing, is empty)
B.h
B.cpp
The file header B.h includes A.h.
Then there is a Win32 console project that consists of a simple file Test.cpp that consists of this code:
Since the compiler essentially just expands any #include files inline, these dependency files need to be available at compile time. In other words, if A.h is #included into B.h and you include B.h into another project, then A.h must be available as well.
To work around this you either make A.h available or reorganize your code to remove A.h as a dependency.
Also, keep in mind that the include file that 'publish' for a dll is usually only the 'interface' to the functions in the dll. As long as the function declarations (or method declarations if you are exporting a class) don't have any dependencies that are contained within A.h, you can move the A.h #include statement out of b.h and into b.cpp.
I have a pack of Classes that i'm using to realize an application that comunicates with some devices.
My need now is that of realize my DLL that invokes some function of this pack of classes.
Of this classes i have only the header file obviously and i want to #include this classes in my DLL.
But it happens that when i try to #include this classes in my DLL starts some errors which do not appear if i #include the same classes in a simple win32 project.
Suppose we have header file:
<vhandtk/A.h> that #includes <vtdim/client.h>
In my DLL i #include the header file <vhandtk/A.h> but when i try to compile it there are many errors which involve a header file <vtdim/socket.h> which is #included in <vtidm/client.h>
This error doen't appear if i #include the same file in a Win32Project.
Any files that are included in the the header file must be available for the compiler to find.
You aren't listing the specific headers, but make the paths to the header files are correct and available. You can set up the project to look for header files in additional directories.
MyChannel::~MyChannel()
{
//TODO:: Add destruction logic here
}
// Overlodaed save channel
bool MyChannel::SaveChannel(A3dFileSaver& saver) {
if(!A3d_Channel::SaveChannel(saver))
return false;
//TODO: Add your logic to save persistent data here
return true;
}
bool MyChannel::LoadChannel(A3dFileLoader& loader, A3d_ChannelGroup *group) {
if(!A3d_Channel::LoadChannel(loader, group))
return false;
//TODO: Add your logic to load persistent data here
return true;
}
void MyChannel:oDependencyInit(A3d_List* currentDependList) {
//TODO: Add eventual dependencies here
try {
tracker = new vhtTracker(trackerConn);
printf("Tracker Connesso");
}
catch (vhtBaseException *e){
printf("Error with tracker: ");
return ;
}
}
Test.cpp and MyChannel.cpp are in the same DLLProject.
When i #include <vhandtk/vhtBase.h> in the Test.cpp there aren't problem.
If i #include <vhandtk/vhtBase.h> in the MyChannel.cpp it launch some errors involving <vtidm/socket.h> which is #included in <vhandtk/vhtBase.h>
I should want to understand why in a normal class there aren't linking problem while in MyChannel.cpp there are.
Compiler error are:
error C2146: errore di sintassi: ';' mancante prima dell'identificatore 'sock'
error C4430: identificatore di tipo mancante, verrà utilizzato int. Nota: default-int non è più supportato in C++
error C4430: identificatore di tipo mancante, verrà utilizzato int. Nota: default-int non è più supportato in C++
error C2079: '_client_socket_t::addr' utilizza struct 'sockaddr_in' non definito
error C2146: errore di sintassi: ';' mancante prima dell'identificatore 'sock'
error C4430: identificatore di tipo mancante, verrà utilizzato int. Nota: default-int non è più supportato in C++
error C4430: identificatore di tipo mancante, verrà utilizzato int. Nota: default-int non è più supportato in C++
error C2146: errore di sintassi: ';' mancante prima dell'identificatore 'afds'
error C4430: identificatore di tipo mancante, verrà utilizzato int. Nota: default-int non è più supportato in C++
error C4430: identificatore di tipo mancante, verrà utilizzato int. Nota: default-int non è più supportato in C++
error C2146: errore di sintassi: ';' mancante prima dell'identificatore 'maxfd'
error C4430: identificatore di tipo mancante, verrà utilizzato int. Nota: default-int non è più supportato in C++
error C4430: identificatore di tipo mancante, verrà utilizzato int. Nota: default-int non è più supportato in C++
error C2065: 'SOCKET': identificatore non dichiarato
error C2146: errore di sintassi: ')' mancante prima dell'identificatore 's'
error C2182: 'VT_SocketClose': utilizzo non valido del tipo 'void'
error C2491: 'VT_SocketClose': definizione di dllimport dati non consentita
error C2059: errore di sintassi: ')'
I'm sorry for italian compiler error but i'm italian
Errors are Syntax error, missing type specifier, definition of dllimport function not allowed
I understand the difficulty of help me.
Thank you in advance.
Bookmarks