LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Object Method as Plugin?

Solved!
Go to solution

Eli Kerry's blog is one of the best for this sort of thing:

http://ekerry.wordpress.com/2013/12/07/the-nuances-of-deploying-plugins-in-labview/

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 11 of 17
(865 Views)

Ok, here is what I've done. I made a much simpler project to try and figure this out. I have attached this project to this post, so you all can get an idea of what I am trying to accomplish in my original program.

 

The simpler program works wonderfully. It works in source code and as an exe when I add new classes and run the program. There was something about my original code that is adding complication and causing this not to work. Maybe some kind of dependency that isn't making its way over?

 

As for the earlier points:

 

to Charles_CLA:

 

1. I am simply creating the new class files and moving them to the EXE directory. This is working in my simple program and EXE. Could it not be working in my original program because of some dependency? How would a source distribution help me? I've never used one before and I am not sure how it would help me in this case. 

 

2. There are no new dependencies in the new class that aren't in the main routine.

 

to Intaris: 

 

1. Definitely not renaming any files, just doing a straight copy of the new files to the proper directory. I am not familiar with the "remove unused members of project libraries" option. Where do I find it?

 

2. I double checked and no errors are generated loading the new class at run time in the EXE with my original program. It loads the new class files, but doesn't run any of the new methods after I copy them over. My new, simple program will do this. 

 

0 Kudos
Message 12 of 17
(850 Views)

I think I just found part of my issue.

 

If I compile my sample program provided in the last post with State 1 through State 3, then those states get compiled into the EXE. Maybe because they are in the project explorer and in memory at compile time?

 

Whatever the reason, since those existed at compile time, I cannot change their methods on the fly. 

 

However, since I added State 4 after I compiled my code, I can change its methods on the fly. 

 

How do I resolve this? By not having the classes in my project explorer so they aren't included in the EXE at compile time?

 

Is this expected behavior? It is quite confusing to be able to load and change new objects after compile time, but not be able to do the same to objects that existed at compile time.

0 Kudos
Message 13 of 17
(844 Views)

Sounds like we're getting somewhere. There are a couple of possible ways to handle this.

  1. Set the location of the classes that are included in your project to your plugin location, they can now be overridden
  2. Set the build of the application to exclude the classes from the build and add them after the fact.
Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
0 Kudos
Message 14 of 17
(838 Views)

I know I have #2 done. 

 

I'm confused what #2 means. As you can see in my example, my classes and plugins are treated as one in the same. Should I not be doing this? If not, what is the benefit? 

 

Perhaps I need to investigate building my plugins in a separate project and install them via a source distribution as Eli Kerry recommends?

0 Kudos
Message 15 of 17
(830 Views)
Solution
Accepted by topic author zenthoef

I modified your project slightly, I forced the application to build the Functional State abstract class into the "Classes\Functional State" folder. I then created a new source distribution (called "Plugins") for your factory commands. I configured the build to exclude all of the static referenced classes (error, exit, functional state, supporting state, and generic plugin), I also forced the destination to preserve folder structure, I believe this to be the major problem that you were experiencing. It was placing the classes together in the top-level folder, then moving their class methods to sub folders, I believe this was causing the linking to get all screwed up. I set the destination directory of the source build to be the Executable\Classes folder. Open the project, build the exe then the source distribution named "Plugins". Run the exe and it should run fine.

Charles Chickering
Architecture is art with rules.

...and the rules are more like guidelines
Message 16 of 17
(820 Views)

Thanks Charles! I finally got around to looknig at this and that is it. Thanks so much!

0 Kudos
Message 17 of 17
(787 Views)