Passing a string from VB.NET to C++ DLL

I need to pass a string from VB.NET to a C++ DLL.
My limitation is that I need to be able to manipulate the string in c++, I need all the functionalty I get from std::string.
I tryed casting to std::string without much luck.
I need the VB.NET type, C++ type and any other casts or code needed to use them.
Thanks!
LVL 6
EladlaAsked:
Who is Participating?
 
CetusMODCommented:
PAQed with points refunded (150)

CetusMOD
Community Support Moderator
0
 
mahesh1402Commented:
I think you may do this using safearrays.

Following may be helpful :

Handling VB strings (as part of an array of UDT)
http://www.codeguru.com/Cpp/W-P/dll/interfacingtovisualbasicapplications/article.php/c103/

Interfacing VB and C++
http://www.flipcode.com/articles/article_vbdlls.shtml

-MAHESH
0
 
EladlaAuthor Commented:
I have seen the flipcode site....not much help to me.
Thanks anyway.
Any other ideas?
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
mahesh1402Commented:
Alternatively have a look at this post which suggesting to use StringBuilder :

http://www.dotnet247.com/247reference/msgs/40/200377.aspx <====

-MAHESH

0
 
EladlaAuthor Commented:
I need something similar to the find function of std:string
or it`s useless to me.
I`ll check out your other link.
0
 
EladlaAuthor Commented:
I checked out the StringBuilder...it would work, but since I`m using unmanaged code and would rather
stick to stdlib C++, I don`t want to import .net namespaces and such.
0
 
EladlaAuthor Commented:
I have already found this:
http://groups.google.com/group/microsoft.public.vc.language/browse_thread/thread/c743b54624a1009c/cee84773330632aa?lnk=st&q=cast+BSTR+to+std%3A%3Astring&rnum=2&hl=en#cee84773330632aa

And it looks like it`s working. If anyone has better ideas, mainly ones that do not require
com or atl type references...please let me know.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.