Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using CString in Console apps

31 views
Skip to first unread message

Raju Varghese

unread,
Apr 8, 1998, 3:00:00 AM4/8/98
to
Hi,

I have a console application that uses CString. Unfortunately, as soon
as one uses CString the linker drags in all the windowing stuff that I
don't need at all. I have linked statically to avoid DLL version
problems. For example the following app is 101K. That's big in my
opinion.

#include <afx.h>

void main (void)
{
CString x ("hello");
}

If I comment out that one line with CString in it it reduces to 21K
which is still big for an app that does nothing but I can live with that
;-). Any ideas why the windowing code gets linked? A solution would be
even better. I'm sure that it is possible. It's just that I ain't clever
enough....yet.

Thanks in advance.

Raju

vcard.vcf

Andy Duplain

unread,
Apr 8, 1998, 3:00:00 AM4/8/98
to

Implement your own String class; it's text-book and good for the soul
8-) Seriously though, I wouldn't recommend using any MFC unless
AppWizard has generated it... you're in for a whole mess of problems.
Just you wait and see.

All the best,
Andy.

Raju Varghese wrote:
>
> Hi,
>
> I have a console application that uses CString. Unfortunately, as soon
> as one uses CString the linker drags in all the windowing stuff that I
> don't need at all. I have linked statically to avoid DLL version

[ deleted ]

Hey please make your signature bigger!

--
Andy Duplain <an...@syntegra.bt.co.uk>
Syntegra, Brighton, UK.

David A. Frantz

unread,
Apr 8, 1998, 3:00:00 AM4/8/98
to

Raju;

CString is MFC, why not try the string facilities suppplied as part of the
standard library.

dave

Raju Varghese wrote in message <352B5FCF...@ubs.com>...


>Hi,
>
>I have a console application that uses CString. Unfortunately, as soon
>as one uses CString the linker drags in all the windowing stuff that I
>don't need at all. I have linked statically to avoid DLL version

Raju Varghese

unread,
Apr 9, 1998, 3:00:00 AM4/9/98
to Andy Duplain
Thanks Andy! From the responses I have received so far I have to conclude
that it is not possible to do what I had in mind.


> Implement your own String class; it's text-book and good for the soul
> 8-) Seriously though, I wouldn't recommend using any MFC unless
> AppWizard has generated it... you're in for a whole mess of problems.
> Just you wait and see.

What happened to that holy grail of programming i.e. reuse. I was trying to
be a Good Programmer and "do the right thing" by reusing Microsoft's tried
and tested code. I used to reinvent the wheel; on occasion several times a
day even ;-) I see your point. I was hoping that there would be a simple way
to extricate CString from the rest of MFC. I remember seeing a KB article
several years back to this effect; I have not been able to locate it
recently.

> > I have a console application that uses CString. Unfortunately, as soon
> > as one uses CString the linker drags in all the windowing stuff that I
> > don't need at all. I have linked statically to avoid DLL version

> [ deleted ]
>
> Hey please make your signature bigger!

My message had two signatures: my first name on a line by itself and the one
put in by Netscape in vCard format. The latter might have got filtered out
by an NNTP server. I admit that the former was a bit short. Both together
would have been just right.

vcard.vcf

Raju Varghese

unread,
Apr 9, 1998, 3:00:00 AM4/9/98
to David A. Frantz
What do need to give up if I use the STL supplied one?

> CString is MFC, why not try the string facilities suppplied as part of the
> standard library.


Raju Varghese UBS, Zurich

vcard.vcf
0 new messages