Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1870 connectés 

  FORUM HardWare.fr
  Programmation
  C

  [C] Créer un .dll

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

[C] Créer un .dll

n°1473769
Siluro
Posté le 11-11-2006 à 00:21:54  profilanswer
 

J'ai un p'tit projet de jeu sympathique en cours.
Pour encore approfondir ma connaissance du C, j'aimerais bien savoir comment créer un .dll, ce truc qu'on lie à notre projet pour pouvoir utiliser les fonctions qu'on a écrite :)
 
J'ai cherché sur le forum : rien.
J'ai cherché sur le net : uniquement à propos du C++ (je FAIS DU C) ou d'autres machins incompréhensibles.
 
Voilà, voilà !


Message édité par Siluro le 11-11-2006 à 11:24:39
mood
Publicité
Posté le 11-11-2006 à 00:21:54  profilanswer
 

n°1473773
Olivier51
Posté le 11-11-2006 à 00:52:21  profilanswer
 

Quelle plateforme : Windows, Linux ?
Quelle IDE : à la mimine, Visual Studio ?
Quel langage : tu es en section 'C' et tu parles de C++ (sur ce point ça sera quasi la meme chose) ?

n°1473774
Olivier51
Posté le 11-11-2006 à 00:58:41  profilanswer
 

En quoi ces sujets ne t'ont pas aidé :
- Creation DLL avec Visual C/C++ 6.0 : http://forum.hardware.fr/hardwaref [...] 3198-1.htm
- Comment creer une DLL avec borland c++ 5.5 compiler : http://forum.hardware.fr/hardwaref [...] 1247-1.htm
- développer une dll avec c++ .net : http://forum.hardware.fr/hardwaref [...] 8141-1.htm
- générer une dll à partir d'un .c : http://forum.hardware.fr/hardwaref [...] 2205-1.htm
- qq1 pourrait me faire une petite DLL en C ? : http://forum.hardware.fr/hardwaref [...] 5813-1.htm
- DLL en C ? http://forum.hardware.fr/hardwaref [...] 8304-1.htm

n°1473846
Siluro
Posté le 11-11-2006 à 11:24:44  profilanswer
 

Windows
DevC++
Je fais du C : les .dll c'est pour du C++ !?
 
Ces sujets ne m'ont pas aidé car ils parlent de C++. Sinon l'avant dernier lien parle de C++ et NON de C, puis le dernier file un lien mort.

n°1473861
Emmanuel D​elahaye
C is a sharp tool
Posté le 11-11-2006 à 12:17:39  profilanswer
 

Siluro a écrit :

Windows
DevC++
Je fais du C : les .dll c'est pour du C++ !?


Non. Rien à voir.
 
Avec dev-C++ quand le fais 'créer une DLL', il prépare le code comme ceci :  
 
dllmain.c :  

Code :
  1. /* Replace "dll.h" with the name of your header */
  2. #include "dll.h"
  3. #include <windows.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. DLLIMPORT void HelloWorld ()
  7. {
  8.     MessageBox (0, "Hello World from DLL!\n", "Hi", MB_ICONINFORMATION);
  9. }
  10. BOOL APIENTRY DllMain (HINSTANCE hInst     /* Library instance handle. */ ,
  11.                        DWORD reason        /* Reason this function is being called. */ ,
  12.                        LPVOID reserved     /* Not used. */ )
  13. {
  14.     switch (reason)
  15.     {
  16.       case DLL_PROCESS_ATTACH:
  17.         break;
  18.       case DLL_PROCESS_DETACH:
  19.         break;
  20.       case DLL_THREAD_ATTACH:
  21.         break;
  22.       case DLL_THREAD_DETACH:
  23.         break;
  24.     }
  25.     /* Returns TRUE on success, FALSE on failure */
  26.     return TRUE;
  27. }


et

Code :
  1. #ifndef _DLL_H_
  2. #define _DLL_H_
  3. #if BUILDING_DLL
  4. # define DLLIMPORT __declspec (dllexport)
  5. #else /* Not BUILDING_DLL */
  6. # define DLLIMPORT __declspec (dllimport)
  7. #endif /* Not BUILDING_DLL */
  8. DLLIMPORT void HelloWorld (void);
  9. #endif /* _DLL_H_ */


Je ne suis pas d'accord avec le _ au début de l'identificateur, mais le principe est là. Ensuite, tu veux savoir quoi ?
 
Il faut surtout apprendre à se servir de MSDN...
 
http://msdn.microsoft.com/library/ [...] raries.asp


Message édité par Emmanuel Delahaye le 11-11-2006 à 12:21:24

---------------
Des infos sur la programmation et le langage C: http://www.bien-programmer.fr Pas de Wi-Fi à la maison : http://www.cpl-france.org/

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  C

  [C] Créer un .dll

 

Sujets relatifs
Cherche personne pour creer un fichir d'install.créer un ascenseur sous dremweaver
Créer un petit programme pr archivage msn[BATCH] Besoin d'un coup de main pour créer un batch
Créer menu en batchCréer une interface admin sur son site
[C# / XML] Créer une arborescence XML grâce à l'héritageCréer un formulaire conforme au html 4 avec un tableau
[VBA] Macro pour créer un classeur contenant une macro[HTML]Créer un template
Plus de sujets relatifs à : [C] Créer un .dll


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR