04-18-2017 10:14 AM
Hello all,
I was hoping to get some help on creating a DLL (I am using VS2017 but hope people on here might be able to trace or help on the issue) using the TDM C DLL functions.
I had everything working fine but one day the function started returning error -6204 when finding groups, and now I cannot even call the DDCOpenFileEx function without receiving the error. When compiled as an application, all works fine. When I change the calls to dll and compile as a DLL it simply returns the error. Attached is a simple test code trying to simply open and close a TDMS file but when I call from LabVIEW, I cannot get past the error.
I think it might be how I set up the project but want to get some advice. Attached is the sample code, I can also attach the VS2017 solution if people would like to check my settings as well. If someone has time to confirm they can get it working, I would greatly appreciate it.
04-19-2017 02:08 PM
Hi there,
You mentioned that everything was working fine and one day the function started returned error -6204.
What has changed between when it was working and now?
-Mitchell Faltin | NI
04-19-2017 02:12 PM
Thanks for the response Mitchell!
i am having trouble deducing that at the moment but I suspect it is something in my project settings maybe not linking the library correctly. I am not extremely fluent in visual studio and I am afraid I changed a setting that I do not know about.
I plan on on starting a fresh dll project and delinking the libraries to see where that gets me. I was hoping someone might be able to do the same as to have a double check.
I will try and find the exact setting change but the code is the same as far as I can tell.
i will report back soon. Thanks for taking the time to talk it through.
04-20-2017 10:07 AM
Is it LabVIEW that throws the error? Or Visual Studio?
To clarify, the end goal is to have a DLL that opens and reads a TDMS file that is invoked by LabVIEW..... correct?
Could you please provide the Visual Studio solution to see if we can't recreate the behavior on our end?
04-20-2017 12:35 PM
Thanks for the help. To update, I am making a seperate project to help address the first posters question and will work that tonight.
To address mfatlin:
1) The error is coming from the DDC library: -6204 an unecpected error occurred in the library. The DLL compiles fine and I can run it with no errors in LabVIEW, but when the code is built as a DLL I get -6204, whereas when built as an exe all works well.
2) Yes that is correct. The c code ( I moved all files besides the test file into a folder called archive as to not clutter your review) will open the TDMS file created by LabVIEW in C and dump it to another file type known as Winplot. LabVIEW will create the file and feed in the path for the c code to process. When this was working all went well, but now I cannot get passed the DDCOpenFileEx function without the error -6204.
Thanks for checking out the solution. I am sure you will have to relink the libraries and header files, maybe this is where my error is? I really appreciate you taking the time to look at this. If you are missing anything (I am not an expert at C and not sure if the resource files will carry over) I can follow up and send them.
The first zip has the solution and c files I am testing. I will follow up with the debug folder containing the dll and exe along with the necessary DDC libraries to run.
04-20-2017 12:37 PM
I should clarify that I return the error in the DLL via an unsigned int. 0 should be what is returned if all works well, otherwise the function returns the library error.
04-20-2017 04:35 PM
I wanted to provide an update. I started another project but still have not had success with the DDC library. Instead, I have linked the CVI TDMS library to my project and changed the necessary function calls. I am no longer receiving errors when opening files or calling functions such as retrieving the number of properties, groups, and others.
I still do not know what is going on with the DDC calls, but the CVI calls are working.
04-21-2017 02:57 PM
So have you abandoned the Visual Studio solution?
04-21-2017 10:58 PM
Hello mfatlin,
Not exactly. I am still in visual studio but have abandoned using the Diadem Connectivity libraries to interface with reading the TDMS files. Instead I am using the CVI tdms libraries.
I did the following:
1) Added the necessary cvi libraries to my VS solution in order to interface with CVI (cvirt and cvisupp) according to the following instructions: http://zone.ni.com/reference/en-XX/help/370051M-01/cvi/programmerref/using_cvi_libraries_in_external...
2) Added the cvitdms library to my solution
3) Added the cvi library directory and header directory to my solution under my solution properties
From there I was able to use the cvitdms.h header file and reference all of the necessary functions for accessing the tdms files. All is compiling and working now. I started small with my test programs and have now completed my project. All is up and running!
Thanks everyone for taking the time. I am not sure what happened with the DDC libs and I am still not able to get them working. Luckily cvi has functions exist to perform the same read/write ops.