Solved

Basic question about string class for C++ .NET

Posted on 2003-11-26
10
450 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
10 Comments
 
LVL 14

Expert Comment

by:Tommy Braas
Comment Utility
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_
Comment Utility
You want to use .NET framework without .NET framework installed?
0
 
LVL 13

Expert Comment

by:SteH
Comment Utility
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
 
LVL 4

Author Comment

by:xassets
Comment Utility
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 14

Expert Comment

by:Tommy Braas
Comment Utility
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
Comment Utility
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
Comment Utility
Question aborted, went the straight C route instead

Thanks to those who contributed
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
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
Comment Utility
Question closed and poitns refunded

PashaMod
CS Moderator
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
MFC Model Dialogs 10 57
std::atomic with custom class 6 149
Lambda for random numbers problem 7 99
Problem with SqlConnection 5 99
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now