Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
1 View

How to call a subroutine in a project from another project?

Hello everybody,

I have a project which includes a lot of subroutines. Now I built a new project and I need to call the subroutines that I have in my previous project but I don't know how to do so...Could you please help me with this problem..

 

Regards,

Faezeh

0 Kudos
1 Reply
Highlighted
1 View

Assuming both project are in

Assuming both project are in the same solution:

If (when) both projects generate an executable, then create a third project in the same solution that generates a library (static or dynamic). Then place the common subroutines to both executable projects into this library project. Make both executable projects dependent upon the library.

While you could add the .obj files of the other project directly, this would not permit a auto-rebuild should one be necessary.

If both current executable projects are in separate solutions, then you can either make a new solution containing the two executable projects as above. Or create the library project (or a library in both projects) an then add the previously built library to the link phase (note, this will not cause the external library to get rebuilt if necessary).

Jim Dempsey

0 Kudos