Quantcast
Channel: LabWindows/CVI topics
Viewing all articles
Browse latest Browse all 5369

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

$
0
0
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


Viewing all articles
Browse latest Browse all 5369

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>