Reputation: 16825
I am creating 2 projects at the moment. The first one is an executable application. The second one is a Dynamic Library. Is there a way to link the Dynamic Library to the application in Netbeans so when I run the application I can load in the Dynamic Library. I know I could just copy the built files over, but that is a pain in the ass as I need to test if it's working every minute.
Does anyone know how to do this? I'm pretty sure it's possible as it would be so useful in many cases.
Upvotes: 5
Views: 3491
Reputation: 1013
An alternative is to point the project that uses the shared library to the directory where netbeans places the .so it generates from the shared library project. In other words, project 1 creates a shared library, project 2 uses it. So in netbeans right click on project2, choose
properties->linker->libraries (click "...")
then click on "add library" and navigate to the folder of project 1 that is the actual netbeans project folder -- in it there will be a "dist" directory, with children, something like "/dist/Debug/linux-x86/.so" choose that .so file
note, project 1 should be created as a netbeans "C Dynamic Library" project, in which case it will automatically pre-pend "lib" in front of the project name when it generates the .so, so that the .so file's name automatically starts with "lib"..
After that, you can update and build the two projects independently, and project 2 will always see the latest build of project 1.
Sean
Upvotes: 1
Reputation: 25350
Yes it's possible:
Application Project -> right click -> Properties -> Linker
Libraries -> ... -> Add Project
-> select your library project (-> check Build and select the Configuration if necessary)Properties -> Related Projects
-> ... -> at your library project thereNot sure if step #4 is required.
If you build your application project, the library project will get build too.
Upvotes: 5