IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Simulink Discussion :

Erreur de lecture d'une dll


Sujet :

Simulink

  1. #1
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2015
    Messages : 6
    Points : 6
    Points
    6
    Par défaut Erreur de lecture d'une dll
    Bonjour, j'ai créé un modèle sous Simulink, puis j'ai généré du code c de ce modèle.
    j'ai copié tt mes fichier .c et .h dans un projet Visual studio afin de créé un exécutable.
    j'ai réussi a compiler mes fichier .c et .h et j'ai généré un exécutable, le problème que j'ai rencontré, est que mon exécutable peux pas lire une dll.
    cette dll s'appelle "networkdevice.dll" st fournit par matab quand on utilise des block de type udp send ou udp receive
    j'ai copier la dll dans mon dossier ou il ya mon exécutable, mais mon programme n'est pas capable de lire la dll.
    S.V.P vous avez une solution

  2. #2
    Expert confirmé
    Avatar de duf42
    Homme Profil pro
    Formateur en informatique
    Inscrit en
    Novembre 2007
    Messages
    3 111
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Formateur en informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2007
    Messages : 3 111
    Points : 4 661
    Points
    4 661
    Par défaut
    Bonjour,

    As-tu un message d'erreur? Lequel?

    Quelle version de MATLAB utilises-tu?

    Duf

  3. #3
    Futur Membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2015
    Messages
    6
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 29
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2015
    Messages : 6
    Points : 6
    Points
    6
    Par défaut
    Enfaîte je reçois pas un message d'erreur, juste dans le code ya une codition, si le programme trouve la dll , il affiche rien mais si le programme ne trouve pas la dll, il affiche un message disant qu'il a pas trouvé cette dll, voici le programme

    Code : 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
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    /**
     * @file HostLib_rtw.c
     * @brief Helper for C clients of the HostLib library.
     * Copyright 2007-2013 The MathWorks, Inc.
     */ 
     
    #include <string.h>
    #include <stdio.h>
     
    #include "HostLib_rtw.h"
     
    /* Open the library and initialize the function pointers */
    void CreateHostLibrary(const char *libName, void *hl) 
    {
        HostLibrary *hostLib = (HostLibrary*)hl;
        *hostLib->errorMessage = '\0';
        memset(hostLib, 0, sizeof(HostLibrary));
    #if defined(_WIN32)
        hostLib->library = LoadLibrary(libName);
        if(hostLib->library == NULL)
            sprintf(hostLib->errorMessage, "Could not open library: %s.\n", libName);
        else {
            hostLib->libCreate    = GetProcAddress(hostLib->library, "libCreate");
            hostLib->libStart     = GetProcAddress(hostLib->library, "libStart"); 
            hostLib->libReset     = GetProcAddress(hostLib->library, "libReset"); 
            hostLib->libUpdate    = GetProcAddress(hostLib->library, "libUpdate");
            hostLib->libOutputs   = GetProcAddress(hostLib->library, "libOutputs");
            hostLib->libTerminate = GetProcAddress(hostLib->library, "libTerminate");
            hostLib->libDestroy   = GetProcAddress(hostLib->library, "libDestroy");
        }
    #elif defined(_VXWORKS_)
        hostLib->library = dlopen(libName, RTLD_NOW);
        if(hostLib->library == NULL) {
            sprintf(hostLib->errorMessage, "Could not open library: %s", libName);
        }
        else {
            hostLib->libCreate    = dlsym(hostLib->library, "libCreate");
            hostLib->libStart     = dlsym(hostLib->library, "libStart"); 
            hostLib->libReset     = dlsym(hostLib->library, "libReset"); 
            hostLib->libUpdate    = dlsym(hostLib->library, "libUpdate");
            hostLib->libOutputs   = dlsym(hostLib->library, "libOutputs");
            hostLib->libTerminate = dlsym(hostLib->library, "libTerminate");
            hostLib->libDestroy   = dlsym(hostLib->library, "libDestroy");
        }
    #else
        hostLib->library = dlopen(libName, RTLD_NOW | RTLD_LOCAL);
        if(hostLib->library == NULL) {
            sprintf(hostLib->errorMessage, "Could not open library: %s", libName);
        }
        else {
            hostLib->libCreate    = dlsym(hostLib->library, "libCreate");
            hostLib->libStart     = dlsym(hostLib->library, "libStart"); 
            hostLib->libReset     = dlsym(hostLib->library, "libReset"); 
            hostLib->libUpdate    = dlsym(hostLib->library, "libUpdate");
            hostLib->libOutputs   = dlsym(hostLib->library, "libOutputs");
            hostLib->libTerminate = dlsym(hostLib->library, "libTerminate");
            hostLib->libDestroy   = dlsym(hostLib->library, "libDestroy");
        }
    #endif
        if(!*hostLib->errorMessage && 
           (!hostLib->libCreate ||
            !hostLib->libStart ||
            !hostLib->libUpdate ||
            !hostLib->libOutputs ||
            !hostLib->libTerminate ||
            !hostLib->libDestroy)
            ) 
        {
            sprintf(hostLib->errorMessage, "Could not determine function entry points in %s", libName);
        }
        if(*hostLib->errorMessage) {
            if (hostLib->library) DestroyHostLibrary(hostLib);
            fprintf(stderr,"%s",hostLib->errorMessage);
        }
    }
     
    /* Close the library */
    void DestroyHostLibrary(void *hl) 
    {
        HostLibrary *hostLib = (HostLibrary*)hl;
        if(hostLib->library) {
    #if defined(_WIN32)
            FreeLibrary(hostLib->library);
    #else
            dlclose(hostLib->library);
    #endif
            /* Clear the structure (except for any possible error message). */
    		memset(hostLib, 0, sizeof(HostLibrary) - MAX_ERR_MSG_LEN);
        }
    }
     
    void LibStart(void *hl)
    {
        HostLibrary *hostLib = (HostLibrary*)hl;
        if(hostLib->instance)
            (MAKE_FCN_PTR(pFnLibStart,hostLib->libStart))(hostLib->instance, hostLib->errorMessage);
    }
     
    void LibReset(void *hl) 
    {
        HostLibrary *hostLib = (HostLibrary*)hl;
        if(hostLib->instance && hostLib->libReset)
            (MAKE_FCN_PTR(pFnLibReset,hostLib->libReset))(hostLib->instance, hostLib->errorMessage);
    }
     
    void LibTerminate(void *hl) 
    {
        HostLibrary *hostLib = (HostLibrary*)hl;
        if(hostLib->instance)
            (MAKE_FCN_PTR(pFnLibTerminate,hostLib->libTerminate))(hostLib->instance, hostLib->errorMessage);
    }
     
    void LibDestroy(void *hl, int type)
    {
        HostLibrary *hostLib = (HostLibrary*)hl;
        if(hostLib->instance)
        {
            (MAKE_FCN_PTR(pFnLibDestroy,hostLib->libDestroy))(hostLib->instance, hostLib->errorMessage, type);
            hostLib->instance = NULL;
        }
    }
     
    int LibError(void *hl) 
    {
        HostLibrary *hostLib = (HostLibrary*)hl;
        return hostLib->errorMessage[0] != '\0';
    }
    void PrintError(char *message)
    {
        /* Print, and then reset, the error message */
        printf("Error: %s\n", message);
        message[0] = '\0';
    }
    void PrintWarning(char *message)
    {
        /* Print, and then reset, the warning message */
        printf("Warning: %s\n", message);
        message[0] = '\0';
    }
    char * GetErrorBuffer(void *hl) 
    {
        HostLibrary *hostLib = (HostLibrary*)hl;
        return hostLib->errorMessage;
    }
    void * GetNullPointer(void) 
    {
        return NULL;
    }

Discussions similaires

  1. erreur de chargement d'une .dll dans un slots
    Par da vinciii dans le forum Qt
    Réponses: 1
    Dernier message: 31/08/2008, 13h18
  2. Erreur à l'appel d'une DLL
    Par Samuel.le dans le forum Général VBA
    Réponses: 0
    Dernier message: 11/10/2007, 18h26
  3. Erreur de lecture d'une video
    Par ZAYDOUN dans le forum MATLAB
    Réponses: 5
    Dernier message: 22/03/2007, 13h34
  4. Localiser une erreur d'exécution dans une DLL
    Par papadrago dans le forum C++Builder
    Réponses: 2
    Dernier message: 08/12/2006, 21h04
  5. Erreur de linkage d'une Dll
    Par Hokagge dans le forum MFC
    Réponses: 1
    Dernier message: 30/03/2006, 14h48

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo