[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c++

dependencies between dll's in visual studio

krissteegmans@gmail.com

12/15/2008 1:30:00 PM

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?
2 Answers

pbozzoli

12/15/2008 1:46:00 PM

0

Have you tryed to use extern in both the dlls?

Paolo


On 15 Dic, 14:29, "krissteegm...@gmail.com" <krissteegm...@gmail.com>
wrote:
> 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?

Paavo Helde

12/15/2008 10:29:00 PM

0

"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