Paavo Helde
12/15/2008 10:29:00 PM
"krissteegmans@gmail.com" <krissteegmans@gmail.com> kirjutas:
> I have the following two functions:
>
> void foo(int i)
> {
> if (i > 0)
> bar(i - 1);
> }
>
> void bar(int i)
> {
> if (i > 0)
> foo(i - 1);
> }
>
> I want both functions to reside in another shared library (foo.dll and
> bar.dll). Note that this is perfectly possible, since they depend only
> on the signature of the other function. I managed to get the thing
> compiled by declaring two projects in my solution. I have to compile
> twice however and change the dependencies for each compilation run to
> get both dll's compiled. Is there a way to do this cleanly?
Shared libraries are not yet in C++ standard, so there is no definitive
answer. You should ask in a ng specific to your implementation (probably
microsoft.public.vc.language).
Aside from that, if the DLL-s are mutually dependent on each other, then
they could be combined in a single DLL a well. Or the part containing foo
and bar could be extracted into a third DLL. Avoiding cycling
dependencies between DLL-s is a good thing IMO.
Paavo