S
Sumedh
Hi everyone
There is a C# project which calls C++/CLI dll to be able to call
native C++ including templates. But the C++/CLI code itself also
requires the C# dll to get the types. For example:
C#:
class Test1
{
void Write()
{
Test1Native::Write(this);
}
}
C++/CLI:
class Test1Native
{
static void Write(Test1^ obj)
{
// calls to some global template and other native C++ functions
here.
}
}
This creates a build inter-dependency problem since the C++/CLI
requires the C# dll while the C# code requires the C++/CLI dll.
Currently i have a couple of possible approaches:
* Repeated builds with different configurations. To do this place the
C# code that calls the C++/CLI code in #if which is unset in the first
build pass, then C++/CLI dll is built and finally build C# again with
the macro defined. This is not nice especially since we shall just be
providing the library with no say on the applications' build
procedure.
* Call Test1Native::Write using reflection from C# to break the
compile time dependency -- this one does not appear very clean either
and shall incur a small overhead (though probably negligible) when
done multiple times.
Is there some other known way to deal with such situations?
Thanks.
There is a C# project which calls C++/CLI dll to be able to call
native C++ including templates. But the C++/CLI code itself also
requires the C# dll to get the types. For example:
C#:
class Test1
{
void Write()
{
Test1Native::Write(this);
}
}
C++/CLI:
class Test1Native
{
static void Write(Test1^ obj)
{
// calls to some global template and other native C++ functions
here.
}
}
This creates a build inter-dependency problem since the C++/CLI
requires the C# dll while the C# code requires the C++/CLI dll.
Currently i have a couple of possible approaches:
* Repeated builds with different configurations. To do this place the
C# code that calls the C++/CLI code in #if which is unset in the first
build pass, then C++/CLI dll is built and finally build C# again with
the macro defined. This is not nice especially since we shall just be
providing the library with no say on the applications' build
procedure.
* Call Test1Native::Write using reflection from C# to break the
compile time dependency -- this one does not appear very clean either
and shall incur a small overhead (though probably negligible) when
done multiple times.
Is there some other known way to deal with such situations?
Thanks.