S
szabi
Hi!
I have seen in a couple of libraries that object are never passed
through dll boundary, instead the results are returned through an
output parameter reference like:
void f(std::string &s)
{
s = "foo";
}
Why is that? Is it a better contruct?? I find this much cleaner:
std::string f(void)
{
return "foo";
}
Another argument could be that it's not safe to return an object, but I
don't understand why. I checked it under Linux and everything is fine.
Lately I have joined the development of a program written in c++ under
MSVC++ 7.1. This code is in a pretty bad shape, so it may not be
connected, but when I try to return a string through dll boundary it
throws an exception.
Any comments?
Szabi
I have seen in a couple of libraries that object are never passed
through dll boundary, instead the results are returned through an
output parameter reference like:
void f(std::string &s)
{
s = "foo";
}
Why is that? Is it a better contruct?? I find this much cleaner:
std::string f(void)
{
return "foo";
}
Another argument could be that it's not safe to return an object, but I
don't understand why. I checked it under Linux and everything is fine.
Lately I have joined the development of a program written in c++ under
MSVC++ 7.1. This code is in a pretty bad shape, so it may not be
connected, but when I try to return a string through dll boundary it
throws an exception.
Any comments?
Szabi