Tester une DLL sous Visual C++

crashburn1 Messages postés 6 Date d'inscription mercredi 29 mars 2006 Statut Membre Dernière intervention 31 mars 2006 - 30 mars 2006 à 17:54
crashburn1 Messages postés 6 Date d'inscription mercredi 29 mars 2006 Statut Membre Dernière intervention 31 mars 2006 - 31 mars 2006 à 10:38
Salut à tous,
Je suis en train de programmer une petite DLL, et je voudrais tester les quelques methodes avant d'aller trop loin.
Pour cela, j'ai créer un projet "Win32 Console Application" dans lequel je fais appel aux methodes dans la DLL.
J'ai juste fait un include de DLLCodec.h qui contient:
#ifdef DLLCODEC_EXPORTS
#define DLLCODEC_API __declspec(dllexport)
#else
#define DLLCODEC_API __declspec(dllimport)
#endif

#include "Types.h"
#include "Constantes.h"
#include "Message.h"
#include "CmdGenerique.h"
#include "CmdRs232.h"
#include "CmdAtpQt.h"
#include "CmdInterne.h"

extern DLLCODEC_API int nDLLCoDec;

// Interface : méthodes exportées
DLLCODEC_API CMessage *encode(const TCmdAtpQt &p_commande);
DLLCODEC_API CMessage *encode(const TCmdInterne &p_commande);
DLLCODEC_API CMessage *encode(const TCmdRs232 &p_commande);

//DLLCODEC_API TInfoCoDec decode( const CMessage &p_message, TCmdGenerique *p_commande );
DLLCODEC_API TCmdGenerique *decode( CMessage *p_message );

// Méthodes internes
u_char *AsciiToBin( const u_char *p_donneeAscii );
void addSeparateur(u_char *p_strData, u_short *p_dataLen);

Mais j'ai les erreurs suivantes:

--------------------Configuration: TestDLLCoDec - Win32 Debug--------------------
Compiling...
Command line warning D4002 : ignoring unknown option '/c '
TestDLLCoDec.cpp
TestDLLCoDec.obj : error LNK2001: unresolved external symbol "public: __thiscall TCmdAtpQt::~TCmdAtpQt(void)" (??1TCmdAtpQt@@QAE@XZ)
TestDLLCoDec.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class TCmdGenerique * __cdecl decode(class CMessage *)" (__imp_?decode@@YAPAVTCmdGenerique@@PAVCMessage@@@Z)
TestDLLCoDec.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) class CMessage * __cdecl encode(class TCmdAtpQt const &)" (__imp_?encode@@YAPAVCMessage@@ABVTCmdAtpQt@@@Z)
TestDLLCoDec.obj : error LNK2001: unresolved external symbol "public: __thiscall CMessage::CMessage(void)" (??0CMessage@@QAE@XZ)
TestDLLCoDec.obj : error LNK2001: unresolved external symbol "public: void __thiscall TCmdAtpQt::setLsb(unsigned long)" (?setLsb@TCmdAtpQt@@QAEXK@Z)
TestDLLCoDec.obj : error LNK2001: unresolved external symbol "public: void __thiscall TCmdAtpQt::setMsb(unsigned long)" (?setMsb@TCmdAtpQt@@QAEXK@Z)
TestDLLCoDec.obj : error LNK2001: unresolved external symbol "public: __thiscall TCmdAtpQt::TCmdAtpQt(void)" (??0TCmdAtpQt@@QAE@XZ)
TestDLLCoDec.exe : fatal error LNK1120: 7 unresolved externals
Error executing cl.exe.

TestDLLCoDec.exe - 8 error(s), 1 warning(s)

Quelqu'un peut il m'aider?
Merci

6 réponses

Zootella Messages postés 252 Date d'inscription vendredi 10 juin 2005 Statut Membre Dernière intervention 5 septembre 2006
30 mars 2006 à 18:23
Tu as ajouté le .lib au projet ?
0
crashburn1 Messages postés 6 Date d'inscription mercredi 29 mars 2006 Statut Membre Dernière intervention 31 mars 2006
31 mars 2006 à 09:06
Quel .lib? c'est une dll, les .lib c'est static non?
et la dll il faut la mettre dans C:/Win32.../system un truc dans le genre.
Mais ça n'intervient qu'à l'execution et non à la compil ou à l'édition de lien.
0
crashburn1 Messages postés 6 Date d'inscription mercredi 29 mars 2006 Statut Membre Dernière intervention 31 mars 2006
31 mars 2006 à 09:09
je rappelle que la compil est passé mais les erreurs interviennent au link
0
crashburn1 Messages postés 6 Date d'inscription mercredi 29 mars 2006 Statut Membre Dernière intervention 31 mars 2006
31 mars 2006 à 09:36
ok, autant pour moi je debute sur les DLL et je savais pas qu'il y avait aussi un .lib

J'ai donc rajouter le .lib dans mon_projet/debug et j'ai rajouter dans Settings->Link: Objects/library modules le nom de mon .lib
j'ai 2erreurs en moins.

Mais il en reste encore 6:

--------------------Configuration: TestDLLCoDec - Win32 Debug--------------------
Linking...
TestDLLCoDec.obj : error LNK2001: unresolved external symbol "public: __thiscall TCmdAtpQt::~TCmdAtpQt(void)" (??1TCmdAtpQt@@QAE@XZ)
TestDLLCoDec.obj : error LNK2001: unresolved external symbol "public: __thiscall CMessage::CMessage(void)" (??0CMessage@@QAE@XZ)
TestDLLCoDec.obj : error LNK2001: unresolved external symbol "public: void __thiscall TCmdAtpQt::setLsb(unsigned long)" (?setLsb@TCmdAtpQt@@QAEXK@Z)
TestDLLCoDec.obj : error LNK2001: unresolved external symbol "public: void __thiscall TCmdAtpQt::setMsb(unsigned long)" (?setMsb@TCmdAtpQt@@QAEXK@Z)
TestDLLCoDec.obj : error LNK2001: unresolved external symbol "public: __thiscall TCmdAtpQt::TCmdAtpQt(void)" (??0TCmdAtpQt@@QAE@XZ)
Debug/TestDLLCoDec.exe : fatal error LNK1120: 5 unresolved externals
Error executing link.exe.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
crashburn1 Messages postés 6 Date d'inscription mercredi 29 mars 2006 Statut Membre Dernière intervention 31 mars 2006
31 mars 2006 à 09:39
Oups!!!!!!!!!!!!!!!
Apres avoir fait un clean, puis un build je ne compile meme plus.

--------------------Configuration: TestDLLCoDec - Win32 Debug--------------------
Compiling...
Command line warning D4002 : ignoring unknown option '/c '
StdAfx.cpp
LINK : fatal error LNK1561: entry point must be defined
Error executing cl.exe.

TestDLLCoDec.exe - 1 error(s), 1 warning(s)

Help me please!!!
0
crashburn1 Messages postés 6 Date d'inscription mercredi 29 mars 2006 Statut Membre Dernière intervention 31 mars 2006
31 mars 2006 à 10:38
j'ai rajouter mainCRTStartup comme point d'entrée et je retrouve mes 8 erreurs de départ!!!!
je ne sais plus quoi faire!!!
0
Rejoignez-nous