Using basic_string in C# 
Author Message
 Using basic_string in C#

Hi!

I have imported a function from a Win32-dll to my C# project. The function
in the dll takes a basic_string, or actually a const basic_string&, as
argument. Is it possible to convert a C#-string to a basic_string.

With basic_string I mean:
#include <string>
std::string str;

Thanks in advance!
/Henke



Mon, 28 Mar 2005 18:18:21 GMT  
 Using basic_string in C#
Henke,

    No, there is not.  You can create another dll that wraps your dll and
then exposes the parameter as something the framework would understand (a
null terminated character string, or a BSTR).

    Hope this helps.

--
               - Nicholas Paldino [.NET/C# MVP]


Quote:
> Hi!

> I have imported a function from a Win32-dll to my C# project. The function
> in the dll takes a basic_string, or actually a const basic_string&, as
> argument. Is it possible to convert a C#-string to a basic_string.

> With basic_string I mean:
> #include <string>
> std::string str;

> Thanks in advance!
> /Henke



Mon, 28 Mar 2005 21:37:27 GMT  
 Using basic_string in C#
Thanks Nicholas, I have control over the dll so I can add a new method that
takes a null terminated char string and make the conversion there.

/Henke



Quote:
> Henke,

>     No, there is not.  You can create another dll that wraps your dll and
> then exposes the parameter as something the framework would understand (a
> null terminated character string, or a BSTR).

>     Hope this helps.

> --
>                - Nicholas Paldino [.NET/C# MVP]



> > Hi!

> > I have imported a function from a Win32-dll to my C# project. The
function
> > in the dll takes a basic_string, or actually a const basic_string&, as
> > argument. Is it possible to convert a C#-string to a basic_string.

> > With basic_string I mean:
> > #include <string>
> > std::string str;

> > Thanks in advance!
> > /Henke



Mon, 28 Mar 2005 22:57:38 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. basic_string<>::data() vs basic_string<>::c_str()

2. assigning basic_string to basic_string - is this by design?

3. VC++ 7.0 basic_string impl uses union

4. Using basic_string class as member of class in dll

5. Help on using basic_string::replace

6. C# , i am trying to create a file on the server using C#

7. Missed conversion operator in basic_string

8. BUG: autoexp.dat is wrong for std:basic_string

9. basic_string case insencitive search

10. Case insensitive compare in STL basic_string

11. BUG: autoexp.dat is wrong for std:basic_string

12. basic_string

 

 
Powered by phpBB® Forum Software