LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI 2015: Generate DLL Import Source generates code with errors

Hello again,

 

The code generated with CVI 2015 has these errors and warnings (all warnings enabled) if you have a header where the functions are decorated with DLLEXPORT or DLLIMPORT like "DLLEXPORT void __stdcall Func(void);"

 

error: expected ';' after top level declarator

warning: declaration does not declare anything [-Wmissing-declarations]

(both are caused by the "__declspec(dllexport);" after the Ptr definition.

 

warning: assigning to 'void (*)()' from 'void *' converts between void pointer and function pointer [-Wtypecheck-convert]

(which is the "...Ptr = (void*) GetProcAddress...")

 

warning: function declaration isn't a prototype. [-Wstrict-prototypes]

error: expected ';' after top level declarator

error: expected identifier or '('

(the function definition "void Func() __declspec(dllexport)")

 

warning: using the result of an assignment as a condition without parentheses [-Wparentheses]

note: place parentheses around the assignment to silence this warning

note: use '==' to turn this assignment into an equality comparison

("if (dllLoadError = LoadDLLIfNeeded())")

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

I'm getting this error [error: expected ';' after top level declarator ] and I have got no clue at all. 

 

You explained that "both are caused by the "__declspec(dllexport);" after the Ptr definition".  

 

What do you mean by "after the Ptr definition" ? What is this Ptr ? 

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

If you export a function like void __stdcall Func(void) then the tool creates a .c file with function pointers like void (__stdcall *Func_Ptr)(). I abbreviated this with "...Ptr".

 

To solve your error: just delete the " __declspec(dllexport)" or " __declspec(dllimport)", that's not supposed to be there and thus causes the error.

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