LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LV crashes on executing a dll

Hi guys,

 

I have written a C function in VS 2010 and then changed it into dll. This is that function before transforming into dll:

 

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}

extern "C"  _declspec(dllexport) extern "C" _declspec(dllexport) int Train(int numOfTrials,
                                                                          int numPerTrial,
                                                                          int numOfCommands,
                                                                          double* Data_in,
                                                                          double* b_in,
                                                                          double* bB_in,
                                                                          double* gmeans1_out,
                                                                          double* gmeans2l_out,
                                                                          double* gmeans2r_out);
void PrintMatrix(CvMat *Matrix,int Rows,int Cols);

extern "C" _declspec(dllexport) int Train(int numOfTrials,
                                          int numPerTrial,
                                          int numOfCommands,
                                          double* Data_in,
                                          double* b_in,
                                          double* bB_in,
                                          double* gmeans1_out,
                                          double* gmeans2l_out,
                                          double* gmeans2r_out)
{ the body of the function...

return 1;

}

 

I created a dll by running this dll application type project in release mode. the problem is that when I run the LV with this dll implemented in it it crashes without giving me any error or a clue. I know that this can happen when the memory allocating in LV does not match the ones used in the function. I've checked and rechecked I don't have that problem. Therefore, I'm looking for a solution here to give me a clue of what is wrong that causes the LV to crash itself.

 

Thank you for your help,

Elnaz

0 Kudos
Message 1 of 3
(2,460 Views)

I don't know if this will help you or if you already read it:

 

http://forums.ni.com/t5/LabVIEW/CLFN-labview-crash/m-p/1211799

 

I was having problems when I upgraded to 2010 with silent crashes. I would check that first and see if you get anything from it. It might not be your DLL, might be LabVIEW calling your dll.

Tom

0 Kudos
Message 2 of 3
(2,452 Views)

I am attaching the dll file here for you to check it out please. There are some messages at the end of the file. It took too long for the dll to be generated. Can the problem be with the dll itself?

0 Kudos
Message 3 of 3
(2,443 Views)