Re: passing using "string" type in DLL Interface
Sarath schrieb:
On Dec 21, 2:41 am, "Brian Muth" <bm...@mvps.org> wrote:
Thanks for all valuable feedback. What I wanted to do is, to pass
something like follows to a dll
struct Data
{
string str1;
string str2;
}
Dear Brian,
Thanks for your reply. I had planned like this to share the data
between the DLL interface and EXE. But I heard like it's not advisable
to share stl containers across. So I really got confused. vector<data>
could be a good bet.
Sareth,
it depends if you can control the DLL usage, or how many EXE are using the DLL.
If the DLL is part of your application, and you build both the DLL and the EXE
with the same compiler version, and only use debug DLL with debug EXE, and if
you dynamically link to the C runtine, then you are fine.
If you give the DLL away to customers or others to be used with different
compilers, then you can not pass std::C++ objects to the DLL. Well, then the DLL
can't have a C++ interface at all. That means you could neither use string nor
vector.
So it depends on what you plan to do with the DLL.
Norbert