Jump to content

Private Class Generator


Recommended Posts

  • 7 months later...
Hi everyone

Attached is a tool that demonstrated how to generated private class controls (and constants).

It does used the technique described in the following post: Public And Private Classid Names

Enjoy

PJM

709[/snapback]

Thanks a lot PJM! This has to be the single best and worst thing I've found on LAVA and OpenG combined. Best because of all the goodies it exposes and worst because, like a really great book, it is hard to put away....

I used this to hack together a little utility that writes the function prototype and parameters to a Call Library Node. The next step is to add a parser for a c/cpp.h file and make a utility that will auto generate wrapper VIs for DLLs, something I have wanted for years. I'll post when I get it finished.

Link to comment
I used this to hack together a little utility that writes the function prototype and parameters to a Call Library Node. The next step is to add a parser for a c/cpp.h file and make a utility that will auto generate wrapper VIs for DLLs,  something I have wanted for years. I'll post when I get it finished.

2906[/snapback]

:thumbup: This one has been on my "wanted" list too for years!

Everyone that had to interface with a dll and manually enter all the datatype knows what a pain in the b...ehind it is :thumbdown: !

I am really looking forward to see your implementation.

Why NI did not do such an utility, I really wonder... :blink:

PJM

Link to comment
:thumbup: This one has been on my "wanted" list too for years!

Everyone that had to interface with a dll and manually enter all the datatype knows what a pain in the b...ehind it is :thumbdown: !

I am really looking forward to see your implementation.

Why NI did not do such an utility, I really wonder... :blink:

PJM

2914[/snapback]

NI has had this ability for years, so they DID do a utility. You can see it in LabVIEW, under:

Menu: Tools > Instrumentation > Import CVI Instrument Driver...

If you point this to a CVI Function Panel file (*.fp) which lists all the functions in the driver, it will then create wrapper LabVIEW VIs for all of the functions, 2, 10 or 100. It was beautiful to watch the first time I saw it work. It did in less than a minute what would have taken me over a week on one driver.

This function is also available in an invoke node, if you know the way to program the parameters. The function requires a CVI.fp, but it should be trivial (relatively) to reprogram to a text file (*.h, etc...) for the function prototypes.

The problem with releasing it as a general DLL conversion tool, from NI's perspective, is that you wouldn't have to buy another expensive software tool like CVI, and it would make it too easy for some of NI's hardware competition to quickly produce LabVIEW drivers for their hardware. NI makes good money off software and training (and they deserve it, great products) but they make more (or always did in the past) off of hardware sales. Recall the internal motto: "The software is the sizzle, but the hardware is the steak!"

Guess its up to us open sourcers...

Link to comment
NI has had this ability for years, so they DID do a utility. You can see it in LabVIEW, under:

Menu: Tools > Instrumentation > Import CVI Instrument Driver...

If you point this to a CVI Function Panel file (*.fp) which lists all the functions in the driver, it will then create wrapper LabVIEW VIs for all of the functions, 2, 10 or 100. It was beautiful to watch the first time I saw it work. It did in less than a minute what would have taken me over a week on one driver.

This is really neat. I did not know about this.

Now, we just need one that will do the same thing out c/cpp.h file :thumbup:

Please, let us know when you are done "hacking" it :D

PJM

Link to comment
  • 3 weeks later...

Still working on this. It's been a while since I played around much with C. There are a few options:

1. Create LabVIEW VIs from header files from scratch.

2. Create CVI fp files from header files

This option requires knowledge of the file format of .fp files. Does anyone know about this?

I put out a call for help with the general parser portion of this utility. We need something to read a header file and

1. sort out what is and is not a function prototype.

2. parse the function prototype. There seem to be more types and pragmas than when I was last programming in C.

3. Related: parse and create LV clusters for structure definitions

4. For those that are to complex, either map or recommend mapping ideas for a shell DLL that will export datatypes that are simple LabVIEW datatypes.

The CVI fp files appear to be binary, here is the NI reference to making a set of LabVIEW VIs from a DLL, but it is using CVI:

http://www.ni.com/support/cvi/visa/default.htm

Note sure if the CVI license agreement specifies if the format of the fp files is closed or open or if we are allowed to look. If not then we are stuck with having to go from header files from scratch.

Any ideas, comments, help would be appreciated!

Link to comment
  • 1 month later...
 

... 

I put out a call for help with the general parser portion of this utility. We need something to read a header file and   

1. sort out what is and is not a function prototype. 

2. parse the function prototype. There seem to be more types and pragmas than when I was last programming in C. 

3. Related: parse and create LV clusters for structure definitions 

4. For those that are to complex, either map or recommend mapping ideas for a shell DLL that will export datatypes that are simple LabVIEW datatypes. 

... 

3189[/snapback]

 

I wouldn't do any parsing stuff, and instead piggyback off of the XML output of either gcc (I've never used it, but I seem to remember that it was possible to get a code structure breakdown as XML from gcc), or Doxygen's XML output.

I had a util that was doing a portion of this for some C++ stuff I was building. It would create GOOP style classes (just copying vi's from templates) for all the methods as well as C method wrappers for each class. Unfortunately this was several months ago (circa LV6.0/1), and I couldn't figure out how to setup the CallLibrary stuff automatically (I don't think it was available at the time) so I ended up dropping the project as it couldn't get me far enough. The really bad part is that I apparently lost all of that work off of an old machine when I reformatted it recently. Most of it was driven by a python script to crunch the XML and generate the wrapper plus drive some VIs to generate the class llb. I will attempt to sift through my backups when I get time to see if I can dig it up.

--edit

Actually I seem to remember at the end of that project determining that I would probably need to integrate with SWIG as managing type conversion in any non trivial way was going to be a bear and SWIG already takes you 90% of the way (eg being able to use objects created by methods of a class). Not only that I now think that I may have used SWIG's xml output instead of doxygen... must find a backup of that project! Regardless I will try and see if I can get something going down this vein, but I am swamped at work... so don't hold your breath.

--end edit

Tuck

Link to comment
  • 4 months later...

solution A

C++ -> Labview

solution B

C++ -> Xml -> Labview

I made same work to test if it is possible to pass from Xml to labview and to creste Labview data structures from Xml structures, if yuo decide to follow solution B, maybe I can help you.

Ciao

Link to comment
NI has had this ability for years, so they DID do a utility. You can see it in LabVIEW, under:

Menu: Tools > Instrumentation > Import CVI Instrument Driver...

If you point this to a CVI Function Panel file (*.fp) which lists all the functions in the driver, it will then create wrapper LabVIEW VIs for all of the functions, 2, 10 or 100. It was beautiful to watch the first time I saw it work. It did in less than a minute what would have taken me over a week on one driver.

This function is also available in an invoke node, if you know the way to program the parameters. The function requires a CVI.fp, but it should be trivial (relatively) to reprogram to a text file (*.h, etc...) for the function prototypes.

The problem with releasing it as a general DLL conversion tool, from NI's perspective, is that you wouldn't have to buy another expensive software tool like CVI, and it would make it too easy for some of NI's hardware competition to quickly produce LabVIEW drivers for their hardware. NI makes good money off software and training (and they deserve it, great products) but they make more (or always did in the past) off of hardware sales. Recall the internal motto: "The software is the sizzle, but the hardware is the steak!"

Guess its up to us open sourcers...

2933[/snapback]

The real problem with this is not that NI is afraid to not sell CVI but the fact that you would have to integrate a complete C parser in LabVIEW to create such a tool. This is a very enormous, and almost undoable thing. This parser can't just work with specially crafted header files but would need to digest any possible header file out there from archane pre ANSI C header files to modern files, with support for preprocessor statements and such. In addition to be meaningful you would need to be able to pass in a whole set of settings such as DEFINEs to use when translating the preprocessor statements.

NI simply has decided, that this is not worth the effort as any solution they can come up with will have some shortcomings for certain header files,or this tool would be starting to get a project of its own of the size for which many more useful features can be built into LabVIEW.

Importing CVI FP panels is a much simpler task. The format is defined by NI, controlled by NI and only really created by NI tools so there are little problems with interpreting what is written in such a file.

Rolf Kalbermatter

Link to comment
  • 1 year later...
Has anybody tried to open this tool in either 8.0 or 8.2?

I get an "Fatal Internal Error" and LabVIEW shuts down.

Ed

Ed,

I believe I post a LV8.0 version somewhere here on the forum (I dont have time right now to locate it) that does not suffer from this issue. For some reason the LV 7.1 version crash because of an enum (this is very odd).

PJM

Link to comment
:thumbup: This one has been on my "wanted" list too for years!

Everyone that had to interface with a dll and manually enter all the datatype knows what a pain in the b...ehind it is :thumbdown: !

I am really looking forward to see your implementation.

Why NI did not do such an utility, I really wonder... :blink:

Didn't we just announce that at NI Week 2006???

http://www.ni.com/niweek/keynote_videos.htm

Take a look at Noel Adorno's presentation. She introduced the DLL Wrapper in the keynote. You can download it from ni.com somewhere... (I don't have that link).

Link to comment
Didn't we just announce that at NI Week 2006???

http://www.ni.com/niweek/keynote_videos.htm

Take a look at Noel Adorno's presentation. She introduced the DLL Wrapper in the keynote. You can download it from ni.com somewhere... (I don't have that link).

Stephen,

Look at the date on the post; this was in december 2004. I can't see that far in the futur yet :P

post-121-1161835415.png?width=400

PJM

Link to comment
  • 1 month later...
I believe I post a LV8.0 version somewhere here on the forum (I dont have time right now to locate it) that does not suffer from this issue. For some reason the LV 7.1 version crash because of an enum (this is very odd).

Does anyone have an idea where the LabVIEW 8.x version of the Private Class Generator is? I've looked everywhere I can think of or search for. Maybe I'm just working on reduced capacity today because I am still on coffee #1 and it is after lunch.

Link to comment
  • 3 weeks later...

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.