Jump to content

Create Typedefs from C-header file #define


Bernd F

Recommended Posts

Hy 2 @ll.

I created some code with typedefs.

These typedefs i created manualy from #defines and typedefs of a headerfile.

Like:

#define LENGTH_FW_REVISION 8 /* including terminator */

typedef struct FwRevision

{

u_16 result;

c_8 string[LENGTH_FW_REVISION];

} FwRevision;

typedef struct RspGetFwRevision

{

FTRspMsgHead common;

FwRevision revision;

} structRspGetFwRevision;

Every time the header-file changes i had to modify the typedefs manualy.

Had someone the same problem and did some concept-VIs ? or

Is there somewhere a Demo-VI, i didn't found?

How to create a Cluster with scripting?

Hints or links will be fantastic, too.

Thanks a lot.

Bernd

Link to comment

I'm just playing with SWIG, whuch is able to parse C/C++ headers and create XML with description of all types and functions. From such XML it should be possible to programatically create typedefs and even wrapper VIs using scripting. I have no usable results yet, but it is promising - I want to use it to automatically create C wrappers for C++ DLLs.

Edited by vugie
Link to comment

I've been using a parser for quite some time to create typedefs. It doesn't pars C/C++ header files since it was designed to pars excel created text files for high channel count digital and analogue IO.

The short answer is yes you can automagically create typedefs (they must not be in memory when you update them) and you don't need to use scripting.

Here is a snippet that shows updating of the typdef.

Link to comment

Hy 2 @ll.

I created some code with typedefs.

These typedefs i created manualy from #defines and typedefs of a headerfile.

Thanks a lot.

Bernd

I am working on an extension of my "Variant To Control" to convert a typedef struct or enum to a LabVIEW control. Here's a beta version of the code:

ArrayToEnum.llb.

Use the 'Struct to Control' VI.

The actual code is in the 'Struct to Variant'. Modify to your needs.

Ton

Link to comment

I am working on an extension of my "Variant To Control" to convert a typedef struct or enum to a LabVIEW control. Here's a beta version of the code:

ArrayToEnum.llb.

Use the 'Struct to Control' VI.

The actual code is in the 'Struct to Variant'. Modify to your needs.

Ton

There is a pw on the "GetContorl From Type Descriptor_A2E.vi ...

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.