473,498 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A problem when using c# dlls in the C++ projects

hi,

I am using a C# library in my C++ project. I want to make use of the
classes defined in the library to do some job, and use the return
value to go on other works in my project. But it seem difficult to
convert a return value of C# datatype into C++ complaint datatype,
like convert System::String in C# into std::string in C++.

like in my test code:

ClassA ^a = gcnew ClassA(); // ClassA is a class in the C# library
System::String result = a-getResult();

std::string str; // here I want to copy result to str, then I can use
the string freely. But I don't know how to do it.

Is there any way ?

Thanks!

Vivienne

Jul 26 '07 #1
1 1067

"Vivienne" <zh**********@gmail.comwrote in message
news:11**********************@x35g2000prf.googlegr oups.com...
hi,

I am using a C# library in my C++ project. I want to make use of the
classes defined in the library to do some job, and use the return
value to go on other works in my project. But it seem difficult to
convert a return value of C# datatype into C++ complaint datatype,
like convert System::String in C# into std::string in C++.

like in my test code:

ClassA ^a = gcnew ClassA(); // ClassA is a class in the C# library
System::String result = a-getResult();

std::string str; // here I want to copy result to str, then I can use
wchar_t* pinResult = result->PtrToStringChars();
std::wstring str(pinResult, result->Length);
the string freely. But I don't know how to do it.

Is there any way ?

Thanks!

Vivienne

Jul 26 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1744
by: Derrick | last post by:
Long story short: I've been working on a project which includes both designtime and runtime components, for both the PC and Pocket PC. While testing, I've been having problems with Visual Studio...
2
2827
by: Johann Blake | last post by:
I can hardly believe I'm the first one to report this, but having gone through the newsgroup, it appears that way. I would like to open a solution in the VS.NET IDE that consists of multiple...
6
1965
by: Derrick | last post by:
Hello all; Since I do have working code, this is more for my curiosity only. I'm creating a "Plugin" architecture, following some of the many examples on the 'net. Basically what I have is...
2
1333
by: | last post by:
I try to build dll in VC .NET, In that project I use dlls that were built in VC6, and I get a lot of errors. (for example <iostream.h> instead of <iostream> etc.) I am not aloud to change anything...
4
1579
by: | last post by:
I posted this question in the past, but have not yet received an answer. Here is the question. By default an ASP.NET app developed in Visual Studio compiles it's code to a DLL located in the...
4
3286
by: moondaddy | last post by:
I have some pubic Enums I like to use throughout my application. Now I'm parsing the application out into smaller DLLs or projects. How an I share a common Enum across all the projects? ...
4
1646
by: Oenone | last post by:
Another VB6 feature that I'm missing in VB.NET is with regard to referencing projects vs. referencing DLLs. In VB6 I can reference my support library, Support.dll, and call its functions. If...
8
1197
by: Brett Romero | last post by:
Say I have four projects - one is an EXE and three are DLLs. The EXE references all three DLLs. If I update one of the DLLs and compile, next time I run my EXE project, it will get the latest...
6
3451
by: tony | last post by:
Hello! I have several projects where each one build a library.(class library or window control library). Now I get some strange compile error when building the *.exe file and doesn't...
10
6564
by: Phil | last post by:
VB2005 Express. I am developing a solution that involves a windows forms application and a number of class library projects (DLLs). Some of the DLLs require extra data files or third party dlls. I...
0
7125
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7002
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7165
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7203
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
4588
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1417
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
290
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.