Claus
asked on
Linking self-made library using MFC stuff
I have made my own library that uses MFC stuff like CString and CTimeSpan. I want to link this library to some other application. I have an include file that describes the interfaces that the application can use in the library. Must this other application be MFC enabled, or can I use the library with a non-MFC program? If MFC is not enabled, CString and CTimeSpan is not recognized. Is there some MFC include file that I can use so that it recognizes CString and CTimeSpan ?
> The calling program does not need to be MFC enabled,
No. If the calling app isn't using MFC, then there's nothing in the calling app to properly initialize MFC. When the code in the statically linked routines starts using MFC, it might not work.
What you're suggesting can be made to work, but it's unreliable, unsupported, and not recommeded.
..B ekiM
No. If the calling app isn't using MFC, then there's nothing in the calling app to properly initialize MFC. When the code in the statically linked routines starts using MFC, it might not work.
What you're suggesting can be made to work, but it's unreliable, unsupported, and not recommeded.
..B ekiM
> Is there some MFC include file
as mike say this is unsuported but not unusual
I think Attilla (WTL) has an CString equivalent http://www.sellsbrothers.com/attila/
which you could probably rip
if the objevt is only based on CObject - it is usally quite easy to rip it out of MFC and make you own versions (but record where you did this - so other people know)
as mike say this is unsuported but not unusual
I think Attilla (WTL) has an CString equivalent http://www.sellsbrothers.com/attila/
which you could probably rip
if the objevt is only based on CObject - it is usally quite easy to rip it out of MFC and make you own versions (but record where you did this - so other people know)
have a look in http://www.codeguru.com/string/index.shtml
for some non MFC string classes
of course you could learn STL and use std::string - veryuseful to have around in non-MFC projects such as ATL/WTL
for some non MFC string classes
of course you could learn STL and use std::string - veryuseful to have around in non-MFC projects such as ATL/WTL
> I think Attilla (WTL) has
Atilla is not WTL. They're very different efforts--you shouldn't confuse them.
..B ekiM
Atilla is not WTL. They're very different efforts--you shouldn't confuse them.
..B ekiM
Interesting .. I know about WTL (in latest SDK) .. how is Atilla different?
> Atilla is not WTL.
oops forgot the (or WTL) :(
>They're very different efforts--you shouldn't confuse them.
I know but since WTL has since been pulled (or so I was informed) - and I believe Chris Sells is trying to get permission to use the WTL source (messages on the Attilla mail list) then I suspect that they will become one.
> how is Atilla different?
Atilla was started as a template library for windowing (Atilla - the name got my vote when it was proposed on the ATL mail list) - since then it was discovered that microsoft was working on WTL and It was asked that they release it so that two competing class libraries could probably merge i.e. the Atilla would become an extension to the WTL ( I don't think that has happened as yet - but I think it should )
there is plenty of info at the chris sells site aand links from that
If WTL (or Atilla) does make it big it could be a challenge to MFC especially for new people who don't want a big chunky app when they can create 1 which doesn't use MFC but is still as useful.
- this is quite a way off but then MFC wasn't much when it started (OWL seemed much better in them days) and look at it now. If WTL gets them same support as MFC or if the Visual Studio code opens up for people to create thier own wizards for WTL (you could probably use the ATL one) as well as classwizard integration then I don't think there would be much stopping it (except Microsoft).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you need more information, Claus?
..B ekiM
..B ekiM
ASKER
No - sorry for not getting back. I got it figured out, I think. I now have my library that requires MFC, and need to wrap it in Java and use it in a Java application. Is there anything special I should take care of here, or is it sufficient just to link the MFC library along with it ?
No. If the library uses MFC, link it to MFC. That's that.
..B ekiM
..B ekiM
ASKER
Answer accepted
Thanks for accepting answer..
CStrings can be passed back as regular strings using the LPCTSTR operator, and CTimeSpan can be passed back as a binary. Your program will have to know how to extract the appropriate fields from the CTimeSpan binary.
I don't think you can include "just enough" MFC to use CString and CTimeSpan directly.