LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI 2013 clang.exe crashes at wrong "extern dllexport"

Another issue...

 

#include <utility.h>

extern DLLEXPORT int crashme;

int __stdcall WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                       LPSTR lpszCmdLine, int nCmdShow)
{
  if (InitCVIRTE (hInstance, 0, 0) == 0)
    return -1;    /* out of memory */
  
  crashme = 1;
  
  return 0;
}

This makes clang.exe crash (using Windows 8, maybe it matters).

-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 1 of 4
(3,659 Views)

Hello!

 

Thanks for reporting the issue. I have filed bug report # 423475 for the problem.

 

However, it appears to me that you're trying to import "crashme" from a DLL into your project. Did you mean to use DLLIMPORT instead of DLLEXPORT? DLLEXPORT suggests that you're trying to export crashme from the current project and it's a little unusual to reexport a variable that you've just imported with "extern". (Unusual but no excuse for clang crashing.)

 

Sorry, the import/export directives are a big confusing. I'll try to summarize:

 

extern int x;

Variable x is declared externally and you're importing it from some other file into this file.

 

DLLIMPORT int x;

Variable x is declared externally in a DLL and you're importing it into this file.

 

DLLEXPORT int x;

Variable x is declared in this file (which is part of a DLL) and you're exporting x from the DLL for use in other DLLs/EXEs.

 

Thanks,

 

Peter

Message 2 of 4
(3,631 Views)

Hello Peter,

 

Thanks for your explanation.

 

Older CVIs accept "extern DLLEXPORT", Clang now complains. Well, some issues in the code surface now.

-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 3 of 4
(3,622 Views)

I thought of another work-around to the problem. Move DLLEXPORT to the definition of the variable, that is, change

 

extern DLLEXPORT int crashme;

to

 

extern int crashme;

and add the DLLEXPORT to wherever 'crashme' is defined:

 

DLLEXPORT int crashme; // in another file
0 Kudos
Message 4 of 4
(3,556 Views)