LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error and DLL

Hi,

I made DLL's with Visual C++ express edition. When i'm calling this DLL's in LabVIEW, everything works fine. (This computer runs with VISTA)

Then i wanted to use these DLLs with an other computer. So I copy Vi's and the DLL's on this computer. (This computer runs with WinXP)

Once I open the VI, I have the following error message : "Erreur lors du chargement de "D:\DLL_WRITE.dll". Cette application n'a pas pu démarrer car la configuration de l'application est incorrecte. Réinstaller l'application pourrait résoudre le probleme"  in french.

In a bad english this message say :" An error occured while loading the D:\DLL_WRITE.dll". This application hadn't be able to start because the application configuration is wrong. Maybe the reinstallation of this application could solve this problem""

Does someone know the meaning of this error ?

For information, here's my DLL source :

//Includes
#include "stdafx.h"   
#include <Windows.h>


//fonction principale de la DLL
BOOL APIENTRY DLLMain (HANDLE hModule,
                           DWORD ul_reason_for_call,
                           LPVOID lpReserved
                           )
{
    return TRUE;
}


extern "C" __declspec(dllexport) void __cdecl Write(HANDLE *WriteH, int *Output);


void __cdecl Write (HANDLE *WriteH, int *Output)
{
    DWORD BytesWritten = 0;
    DWORD BytesRead = 0;
    unsigned char OutputPacketBuffer[65];   
       
   
         
     OutputPacketBuffer[0] = 0;

    OutputPacketBuffer[1] = 0x80;  

    OutputPacketBuffer[2] = *Output;

    WriteFile(*WriteH, &OutputPacketBuffer, 65, &BytesWritten, 0);  
                
         
} // end of Write

Thank you for your help !

(and I apologize about my english ! 😉 )

Best regard,

Jérôme.


0 Kudos
Message 1 of 17
(3,960 Views)
Hi! Can you please post your compiled DLL here?
0 Kudos
Message 2 of 17
(3,956 Views)
Hi,

here's my compiled DLL !


Thank you for your help !

Jérôme.
0 Kudos
Message 3 of 17
(3,949 Views)

Hi, Jérôme,

well, now I see what happened. Your DLL required DLL_Write.dll.2.Manifest and DLL_Write.dll.2.Config files (or something like that). You should place these files into the same directory with DLL, or recompile DLL without manifest (don't remember which option in MSVS responcible for that).

best regards,
Andrey.

Message 4 of 17
(3,944 Views)
Thank you for your help Andrey !

i'm going to try it right now !
0 Kudos
Message 5 of 17
(3,940 Views)
Hi again !!

I didn't find the file named DLL_Write.dll.2.Config in my "debug" directory. 

So i tried with only
DLL_Write.dll.2.Manifest but it didn't work.

I tried also to place all files in my "debug" directory, it didn't word neither.

And the compilation without manifest make a DLL which when I call it, Labview say MSVCR90D.dll is
unobtainable.


Best regards,
Jérôme.
0 Kudos
Message 6 of 17
(3,931 Views)

MSVCR90D.dll is C Run-Time library (debug version in this case). I guess this also can be turned off in MSVC, or you can remove switches /MT /MD /LD from compiler options if they present.

Andrey.

 

Message 7 of 17
(3,916 Views)
Hi !!

For 2 of my 3 dll's it works well if i change the /MD by /MT. It compiles well and DLLs work well too.

BUT ! 😉

one of my DLL  refuse to compile because it uses CLR (in order to be able to use system.dll from .NET Framework 3.5) and the compilator says that /clr and /MT are incompatible.


here's the code of my dll, this is code to get the handle of usb device. I post the compiled DLL too. Thank you for your help !



Best regards,

Jérôme.




Download All
0 Kudos
Message 8 of 17
(3,904 Views)
Hi,
then I will recommend to read this document first. Probably additional Run-Time library is really needed for your DLL.
From this point the troubles are not LabVIEW-related, but M$VC, but I'm not so deep in this environment...
Andrey.
Message 9 of 17
(3,896 Views)
Hi Andrey !

i'm reading your document ! I'm beginner in C++, it is little bit complicated to me ! 😉

You help me a lot, i had the feeling that you was in front of my computer ! (awesome ! 🙂 )

So i'll read the document and i come back here to tell you how my problem progress !

Thank you again !

Best regards,
Jérôme.
0 Kudos
Message 10 of 17
(3,879 Views)