Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Basic question about string class for C++ .NET

Posted on 2003-11-26
10
Medium Priority
?
457 Views
Last Modified: 2010-08-05
I want to use a string class which does not require any additional DLLs, so that the exe I compile can run on a clean build win95 box simply by copying the exe. Whenever I try to use string, String or CString in C++ it seems to require additional components. When I added mscorlib.dll (.net framework) it was ok. What I need is a string class which does not need .net framework. I also need a registry class and some classes for handling arrays would be nice.

I found a few string classes on the web but who can you trust ?

Main things I need are things like split, join, replace etc etc functionality

Would be nice if my resulting code remained compiler independent but its OK to lock into win32 platforms.

Full points for a solution that gets me bug free string class and a registry class which works without external dlls (kernel, user advapi etc are acceptable)
0
Comment
Question by:xassets
9 Comments
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 9829997
I would suggest that you use the standard classes and Standard Template Library classes provided standard with most C++ compiler. A word of warning: any MS C++ compiler does not support the full definition of the C++ language.

For verification purposes, using GCC is a good idea! GCC can be downloaded for free at
   http://www.gnu.org/directory/devel/compilers/gcc.html

It seems to me however that you're linking to the .NET framework, instead of to the crt (c runtime). Have a look at your linker settings in your project, make sure that you're not linking to the .NET runtime.

Arguments above are also true for accessing the registry. I don't think that there is a class abstraction for the registry, however the API calls are easy to follow.
0
 
LVL 8

Expert Comment

by:_corey_
ID: 9830251
You want to use .NET framework without .NET framework installed?
0
 
LVL 13

Expert Comment

by:SteH
ID: 9830282
Be sure to check projects settings to use the non DLL version of the C run time library. At least in VC6 you had the option between single threaded, multi threaded and multi threaded DLL. The last needs then DLLs to be copied with the project, whereas the others don't.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 4

Author Comment

by:xassets
ID: 9830446
Definitely a beginner to VC, .NET and C++, but on a mission to get 10k lines of vb rewritten to C++ in a few days!

I'm just using the .NET compiler because its already installed. It seems to be similar to VC6 and I can write simple hello world programs which will run on win95 with only copying the exe (no dlls or .net framework). I just need to be able to use string classes etc and hopefully a registry class (apis are fine, wrappers would be nice), and still be able to install on win95 just by copying the exe.

Don't want to use the .net framework - just want an exe that works on its own, don't care if I have to use .net or vc6, they seem similar to me!

Checked the project settings and can't really see anything for C run time library, the MFC setting is "Use Standard Windows Libraries".

0
 
LVL 14

Expert Comment

by:Tommy Braas
ID: 9830487
I would recommend that you have a look at the compiler and linker settings for the simple Hello World sample project and mimic those settings in your own project.
0
 
LVL 4

Author Comment

by:xassets
ID: 9830915
I have been unable to find a hello world sample which uses a string class and does not require a dll. Thats definitely all i need
0
 
LVL 4

Author Comment

by:xassets
ID: 9850618
Question aborted, went the straight C route instead

Thanks to those who contributed
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 9879333
xassets,
Please finalize this question.  See http:/help.jsp#hs5
-- Dan Rollins, EE C++ area Page Editor
0
 

Accepted Solution

by:
PashaMod earned 0 total points
ID: 9901062
Question closed and poitns refunded

PashaMod
CS Moderator
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question