Une application d'un seul fichier "c" doit tourner en tant que service.
J'utilise donc en plus les fichiers service.cpp, service.h, simple.cpp.
Le fichier S_Gest_Evt_Expl.c contient une seule fonction main_org:
Code :
- int main_org(int argc, char *argv[])
- {
|
Le fichier simple.cpp:
Code :
- #include <windows.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <process.h>
- #include <tchar.h>
- #include "service.h"
- extern int main_org(int argc, char *argv[]);
- extern int chdir (const char *);
- .
- .
- .
- .
- VOID ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv)
- {
- ////////////////////////////////////////////////////////
- //
- // Service is now running, perform work until shutdown
- //
- main_org(dwArgc , lpszArgv);
- exit(0);
- }
|
Voici le résultat du Build Debug et/ou Release sur .NET:
Code :
- ------ Rebuild All started: Project: S_GEST_EVT_EXPL, Configuration: Debug Win32 ------
- Deleting intermediate files and output files for project 'S_GEST_EVT_EXPL', configuration 'Debug|Win32'.
- Compiling...
- simple.cpp
- service.cpp
- Generating Code...
- Compiling...
- S_Gest_Evt_Expl.c
- Linking...
- simple.obj : fatal error LNK1284: metadata inconsistent with COFF symbol table: symbol '?main_org@@$$FYAHHQAPAD@Z' (0A00001E) mapped to '?main_org@@$$J0YAHHPAPAD@Z' (06000001) in S_Gest_Evt_Expl.obj
- Build log was saved at "file://d:\Dev\Aei\S_gest_evt_expl\Debug\BuildLog.htm"
- S_GEST_EVT_EXPL - 1 error(s), 0 warning(s)
- ---------------------- Done ----------------------
|
2 autres projets utilisent exactement le même schéma de service. Les 3 fichiers de service sont identiques, et l'appel vers le main_org de l'appli se fait de la même facon.
Si quelqu'un a un début de piste, je suis preneur.
Merci de vos réponses