Re: migration to non-attributed(!) ATL?
- From: "Erik Cassel" <ErikCassel@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 13 Jun 2005 09:41:05 -0700
Thanks for the tip. Sadly, it injects full C++ code rather than the ATL
macros. No surprise, I suppose.
I've decided on a method D:
1) Put my new code in a new ATL/MFC dll
2) dllexport the new code
3) Have the old attributed dll import/load the new dll
It's a little hacky, but it'll work
-Erik
"Maciej Mróz" wrote:
> Użytkownik Erik Cassel napisał:
>
> > Seemingly contrary to the prevailing experience, I've done quite well using
> > ATL's attributed COM.
> >
> > Sadly, I’ve hit a roadblock: I want to add some 3rd party MFC code to my
> > DLL, which means I need to create an ATL DLL with MFC support. You can’t do
> > that with attributes!
> >
> > What are my choices for migrating my “legacy” COM classes? (20+ controls,
> > 10+ event sources, more than a hundred methods and properties)
> >
> > I can think of a few methods:
> >
> > Method A)
> >
> > 1) Create each class all over again using the non-attributed wizards, taking
> > care to re-create the options I used the first time around (event sources,
> > error info, threading, progid, etc)
> > 2) Copy/Paste the __interface definitions into the project’s IDL file
> > 3) Copy/Paste all the other logic from the class
> >
> > Method B)
> >
> > 1) Use the existing .h and .cpp files for all my classes, but strip out the
> > __interface definitions
> > 2) Drop the contents of the autogenerated IDL file (_MyProject.idl) from the
> > attributed project into the new project’s IDL file
> > 3) Substitute appropriate macros for the class attributes
> >
> > Method C)
> >
> > 1) Does the attributed system generate intermediate files that would work in
> > a non-attributed project? Would it preserve comments and formatting?
> >
> >
> >
> > Method A has some big disadvantages: Errors can be introduced in step A1 and
> > especially in step A2
> >
> > Method B has risks: Would step B1 actually work? Is there an easy mapping
> > from attributes to macros?
> >
> > Method C is my fantasy scenario :)
>
> In fact, if I remember correctly, there is a way to save attributed code
> to disk after attribute expansion (somewhere in compiler options,
> "Expand attributes" or something like that).
> I have done the "backporting" thing, very long time ago, all manually :(
> - fortunately I only had two or three projects like that, and they vere
> relatively small.
> Lesson learned: never use ATL attributes.
>
> regards,
> Maciej Mróz
>
> >
> >
> > Has anybody done this?
> >
> >
>
.
- References:
- migration to non-attributed(!) ATL?
- From: Erik Cassel
- Re: migration to non-attributed(!) ATL?
- From: Maciej Mróz
- migration to non-attributed(!) ATL?
- Prev by Date: Re: BSTR compare with embedded nul characters
- Next by Date: Re: WinInet and Connection Points crashes during event firing in atlco
- Previous by thread: Re: migration to non-attributed(!) ATL?
- Next by thread: #import & hidden attribute
- Index(es):
Relevant Pages
|