08-18-2017 07:56 AM
Hello,
Difference between Getfilesize from cvi labwindows and API Getfilesize.
if API Getfilesize is used in CVI 2015 its return error.
08-18-2017 08:23 AM
Imagine two books from different authors - they may happen to have the same title, but most probably their contents will be different. It's the same with two functions from two different libraries, the may have the same function name but perform the task in a different way, with different parameters etc. So in most cases you cannot exchange them one by one and will receive a (justified) complaint from the linker.
The answer to your problem is given here.
08-20-2017 11:07 PM
If Getfilesize is been called from other source ex: Borland Application is linked to CVI Labwindows through DLL. In this case if GetFileSize used as API call in borland the file handel will be junk. how to resolve it ?
08-22-2017 05:40 AM - edited 08-22-2017 05:43 AM
You can't mix and much IO library calls ever between different libraries. This even is true for different versions of the Standard C runtime libraries.
The fopen() may return something that looks like a handle (by definition it is a pointer to a FILE type whose meaning is private to the library). You then better make sure to only pass this parameter to other file functions from the same C runtime library. In Visual C you can for instance end up using different C runtime library versions, if you link for instance to a DLL which was compiled with a different Visual C version than the version you are using for your application. The DLL uses whatever version of the C runtime library it was linked with at the time it was built and your application links to a different version. If you start passing FILE * handles between your application and that DLL and hope everything will work, you will be badly surprised.
Basically anything like handles, file identifiers and such things are generally to be considered private to the API library (and version) they were created in and have no meaning whatsoever in another context. Same about the handles/identifiers returned by the LabWindows CVI IO library. They are private to this library and have only a meaning in the context of this library. They could be directly a Windows file handle, but they could also be a pointer or an index into a library private data table that contains the necessary information to deal with the file in question properly. And even if you might find out that they are in a certain LabWindows CVI version indeed a Windows file handle, there is absolutely no guarantee that this would remain like that in another version of LabWindows CVI unless it is explicitly spelled out in the documentation to be so, which it is not! You can even infer that from the fact that the LabWindows CVI file handle is an integer (so always 32 bit in size) while a Windows file handle is a pointer sized opaque data type.