LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Trouble to create a FunctionPa​nel with the File Management Library (ANSI_C)

Hello,

 

Step 1 : Creation of the project

I am creating a low level library. Its aim is to personnalize the file management (add an error management).

I am using the fopen, fclose, ... functions form the ANSI_C library.

      => The compilation and the utilization work very well.

 

Step 2 : Création of the FunctionPanel

The creation of the function panel and the local utilization into the project work also correctly.

To use the function panel into a highest level, I include the file *.fp to the compilation (via "Type Library").

      => Trouble 1 : The type FILE declare into the header "stdio.h" is not with the good format (structures have to be a typedef...).

 

CURRENT :                                                                                            MODIFY :

struct _mode {                                                                                        typedef struct {

    unsigned int read:1;
    unsigned int write:1;
    unsigned int append:1;
    unsigned int binary:1;
    unsigned int create:1;
    unsigned int truncate:1;
    unsigned int fdopen:1;
    unsigned int reserved:25;
};                                                                                                           }  _mode;

 

struct _state {                                                                                        typedef struct {
    unsigned int bufalloc:1;
    unsigned int filealloc:1;
    unsigned int eof:1;
    unsigned int error:1;
    unsigned int linebuf:1;
    unsigned int nobuf:1;
    unsigned int wasread:1;
    unsigned int waswritten:1;
    unsigned int InUse:1;
    unsigned int reserved:23;
};                                                                                                           }  _state;


typedef struct {
    struct _mode mode;                                                                             _mode mode;
    struct _state state;                                                                              _state state;
    int   handle;
    unsigned char *buffer;
    unsigned char *bufferEnd;
    unsigned char *next;
    unsigned char *readEnd;
    unsigned char *writeEnd;
    unsigned char *readEndSave;
    unsigned char pushedBack[6];
    char numPushedBack;
    unsigned char defaultBuf;
    unsigned char *tmpname;
    void *lock;
    int   consoleHandle;    // Console handle for host stdio
} FILE;

 

THIS MODIFICATION IS NOT ADMISSIBLE : I WILL DELIVER MY NEW LIB TO THE OTHER MANUFACTURE OF OUR GROUP...

 

      => Trouble 2 : Despite the modification modification of "stdio.h" (Juste to progress), the compilation works but I have got the following error and the function panel is still not visible to the upper level.

 

9 Project link errors
 Error generating type library.  Midl.exe failed while compiling the odl file used to create the type library.
 Note: The error indicates that the odl file has unknown types. This error is possible when
 functions with non-standard types are exported using the export qualifier method from files in
 release configuration that have not been recompiled during the build process. You can mark all
 files for recompilation and repeat the build. To avoid this situation, it is recommended that
 you export these functions using the include file method.
 Use the generated odl file "c:\TestSources\ESSAI IMBRICATION\1-DriverFunctions.odl" with the command line:
 c:\PROGRA~2\NATION~1\cvi2010\sdk\bin\midl.exe "c:\TestSources\ESSAI IMBRICATION\1-DriverFunctions.odl" /win32 /mktyplib203 /tlb "1-DriverFunctions.tlb" /Ic:\PROGRA~2\NATION~1\cvi2010\sdk\include /cpp_cmd c:\PROGRA~2\NATION~1\cvi2010\bin\preprocessor.exe
 to see what errors midl.exe reported.

 

 

      => Question 1 : How can I make working the function panel onto the upper level

 

      => Question 2 : How can I declare the type FILE as a custom type into the function panel (to have the good input parameter into the prototype of my functions) ?

 

      => Question 3 : I made a try with the "inifile.fp". To include this FP to my librairy, I have to include the "inifile.obj" to the "LoadExternalModule" option for compilation. Is this difference normal between a custom FP and a NI FP ?

 

      => Question 4 (Other subject) : I joined a project to explain my trouble. I would like also to call low level project. Is it possible to call only the library of the level -1 and calling fonction and FP from the level - 2.

I will open an other post on this suject "How include a project level -2 into a project level -1 to not call it into the level 0"

 

 

 

                                                         Thank very much

 

                                                                                                                 Guillaume

0 Kudos
Message 1 of 3
(3,385 Views)

Hello,

 

I'm really unsure if I understood the global issue, but I'll try to answer the first 2 questions. The .fp instrument drivers are not generic to any compiler. Which means that once you create the dll and the lib for a given piece of code embedding a .fp, you may lose the ability to use the instrument driver with its function panel when loading the dll/lib in other projects/workspaces.

 

About the stdio.h issue, I don't see why this would be a problem. Meanwhile, changing the type of the data of stdio.h results in different symbol linking issues that can happen after the compilation process (when executing). Midl notably expects well-defined types, so if you change those latter, you will not be able to correctly use some of the ansi C functions.

 

Regards,

Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.

Message 2 of 3
(3,363 Views)

Against the lost of the low level function panel, if function panel are included to upper level, it is not too important...

 

 

The "Stdio.h" file is a NI header.

I would prefer not make a modification of this file :

             - When I will deliver my library to an other manufacture, production technicians will forget to update it.

             - When NI drivers will be updated, production technicians will not able to identifie the trouble and correct it.

 

 

                          Thank for your responce

 

                                                       Guillaume

0 Kudos
Message 3 of 3
(3,355 Views)