Bonjour,

j'écrie un programme en c++ sous C::B (débutant ) mais en faisant appel à la dll ociliba en 32bits. A la compilation j'ai une erreur en ligne 47 "error: invalid use of incomplete type 'OCI_Error {aka struct OCI_Error}'"

Le même programme compilé en static avec appel de OCI_GetLastError fonctionne. Merci de votre aide, je rame...

Code C++ : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include "ocilib.h"
#include "InsORA.h"
#include "GesErr.h"
#include "../MesFonctions.h"
#include <string>
#include <iostream>
 
using namespace std;
 
//constructeur
InsORA::InsORA(const char* a, const char* b, const char* c, int d) :
    Instance(a),
    Utilisateur(b),
    MdP(c),
    MatriculeAgent(d)
{
}
 
bool InsORA::connexionBase()
{
    HINSTANCE hinstLib = LoadLibrary(TEXT("ociliba.dll"));
    if (hinstLib == NULL) {
            cout << "ERREUR: impossible de charger la DLL " << endl;
            FreeLibrary(hinstLib);
            return false;
    }
 
    cn=NULL;
 
    importF13 ociGetLastError;
    ociGetLastError = (importF13)GetProcAddress(hinstLib, "_OCI_GetLastError@0");
    if (ociGetLastError == NULL) {
            cout << "ERREUR: impossible de trouver dans la DLL la fonction '_OCI_GetLastError@0'" << endl;
            FreeLibrary(hinstLib);
            return false;
    }
 
 
    importF20 ociInitialize;
    ociInitialize = (importF20)GetProcAddress(hinstLib, "_OCI_Initialize@12");
    if (ociInitialize == NULL) {
            cout << "ERREUR: impossible de trouver dans la DLL la fonction '_OCI_Initialize@12'" << endl;
            FreeLibrary(hinstLib);
            return false;
    }else if(!ociInitialize(NULL, NULL, OCI_ENV_CONTEXT )){
        GesErr::err_handler(ociGetLastError());
        FreeLibrary(hinstLib);
        return false;
    }
 
/*
 
...encore du code...
 
*/
    FreeLibrary(hinstLib);
    return true;
}
 
void InsORA::deconnexionBase(){
    //OCI_ConnectionFree(cn);
    //OCI_Cleanup();
}
 
string InsORA::getInstance(){return Instance;}
 
string InsORA::getUtilisateur(){return Utilisateur;}
 
string InsORA::getMdP(){return MdP;}
 
OCI_Connection *InsORA::getObjCn(void)
{
    return this->cn;
}
 
void InsORA::Affiche()
{
    //cout << Instance << ", " << Utilisateur << ", " << MdP << endl;
    cout << endl;
    /*
    cout << OCI_GetVersionServer(cn) << endl;
    cout << "Server major    version : " << OCI_GetServerMajorVersion(cn)<< endl;
    cout << "Server minor    version : " << OCI_GetServerMinorVersion(cn)<< endl;
    cout << "Server revision version : " << OCI_GetServerRevisionVersion(cn)<< endl;
    cout << "Connection      version : " << OCI_GetVersionConnection(cn)<< endl;
    */
}
 
 //destructeur
InsORA::~InsORA(){}

et la classe GesErr

Code C++ : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "ocilib.h"
#include "GesErr.h"
#include <string>
#include <iostream>
#include <errno.h>
#include "../MesFonctions.h"
 
 
using namespace std;
 
//ctor
GesErr::GesErr()
{
}
 
void GesErr::err_handler(OCI_Error * err)
{
 
    HINSTANCE hinstLib = LoadLibrary(TEXT("ociliba.dll"));
    if (hinstLib == NULL) {
            cout << "ERREUR: impossible de charger la DLL " << endl;
            FreeLibrary(hinstLib);
    }
 
    importF16 ociErrorGetOCICode;
    ociErrorGetOCICode = (importF16)GetProcAddress(hinstLib, "_OCI_ErrorGetOCICode@4");
    if (ociErrorGetOCICode == NULL) {
            cout << "ERREUR: impossible de trouver dans la DLL la fonction '_OCI_ErrorGetOCICode@4'" << endl;
            FreeLibrary(hinstLib);
    }
 
    importF8 ociErrorGetString;
    ociErrorGetString = (importF8)GetProcAddress(hinstLib, "_OCI_ErrorGetString@4");
    if (ociErrorGetString == NULL) {
            cout << "ERREUR: impossible de trouver dans la DLL la fonction '_OCI_ErrorGetString@4'" << endl;
            FreeLibrary(hinstLib);
    }
 
    importF7 ociErrorGetStatement;
    ociErrorGetStatement = (importF7)GetProcAddress(hinstLib, "_OCI_ErrorGetStatement@4");
    if (ociErrorGetStatement == NULL) {
            cout << "ERREUR: impossible de trouver dans la DLL la fonction '_OCI_ErrorGetStatement@4" << endl;
            FreeLibrary(hinstLib);
    }
 
    cout << "code  : ORA-" << ociErrorGetOCICode(err) << endl;
    cout << "msg   : " << ociErrorGetString(err) << endl;
    cout << "sql   : " << ociGetSql(ociErrorGetStatement(err)) << endl;
 
 
    FreeLibrary(hinstLib);
 
}
 
//dtor
GesErr::~GesErr()
{
}