- design the interface using Qt C++
- write the C program and make it into a dynamic library
- make the C++ plugin call the C program using LibraryThread
- place the C++ dynamic library in the "menu.txt" file so that it appears along with the other "functions".
Normal C dynamic libraries are loaded using the LibraryThread class. However, since these C++ programs are different, the LibraryThread performs a check to see whether the "loadTCTool" function exists in the library. If it does exist, then the library is loaded as a plugin on the main thread and not as a threaded C program, which is usually on a separate thread.
The diagram above shows how different libraries are loaded. Essentially, if the library contains the "run" function, it is assumed to be a C program. If it contains the "loadTCTool" function, it is assumed to be a C++ library that adds a new tool to the main window. The LibraryThread runs the C program on a separate thread and unloads the library when the program is finished. The C++ libraries represent widgets and other such tools which are only unloaded when TinkerCell exists.
No comments:
Post a Comment