05-16-2012 01:09 AM
i am getting an error during Exporting a function to create my own DLL. its prototype is
__declspec(dllexport) WDC_DEVICE_HANDLE SP6_2008_MOD_DeviceOpen(const WD_PCI_CARD_INFO *pDeviceInfo);
} WD_PCI_CARD_INFO, WD_PCI_CARD_INFO_V30;
the error point has been highlighted in the above statement. i am attaching the snapshot also.
this code was working fine in visual studio 2008 earlier. whats wrong here in labwindows then !!!
thanks with regards
05-17-2012 06:04 AM
the definition which i referred to in my query has been included in the header file (present in my project)
it also gives similar error for other exported function also.
i am also including my project for your reference. Some more header files which may be required are copied in to this project folder.
thanks and regards
05-18-2012 12:10 PM
Since you mentioned that the code worked perfectly fine in Visual Studio 2008, I think that the problem lies elsewhere. Both CVI and Visual Studio should be able to compile and run C code since ANSI C hasn't changed in a very long time. Perhaps it has something to do with a difference in the Build Options in CVI. One thing that came to mind is the calling convention that was used. I think that by default VS uses cdecl calling convention. You can read some more about calling conventions here. To change the calling convention to cdecl from stdcall in LabWindows/CVI you can open up the Build Options dialog box from the Options menu.
Hope that helps.
05-22-2012 02:40 AM
the point where i am getting the Error "found '*' expecting ')' " is basically a pointer to structure of structures (of a third party whose definitions have been included in the included Headers). just for checking i made another structure (ActivityFlags) in my existing structure (BCCreateMsg) and referenced it using a pointer in "BCXmtMsg" function. But this gave no Error.........This is very strange !!!
For simplicity i remarked one of the structure variable (WD_ITEMS) in the WD_CARD_PCI_INFO structure, so the other structure WD_PCI_SLOT only has simple variables now. But still i get the same error and DLL creation is aborted.
can you please explain the difference for WHY compiler is behaving unpredictably for the very similar functions, structures and arguments.
i am attaching the project also for the above scenario.
i have tried by changing the calling conventions but that makes no difference in this situation.
hoping to have the prompt favourable solution...
thanks and regards..
05-23-2012 03:15 PM
I have tried to replicate the error you are seeing and cannot reproduce it.
In theory everything you are doing seems to be fine. I have even tried referencing a struct that referenced a struct which had another struct in it, to immediate your code, and I was able to compile without any issues.
For some reason when I try to compile your code I get other compilation errors.
Which version of LabWindows/CVI are you using?
Have you tried copying the code into a new project with empty c and h files? Basically copying and pasting the text from each file into new ones to duplicate the project. It may be that something got corrupted with the code in transferring it from Visual Studio to LabWindows/CVI.
The compiler should work the way you are expecting it to work.
05-25-2012 05:19 AM
that problem has resolved. i was actually including the header which had the definitions oof the structure after the file having their prototypes.
thanks a lot for your guidance.