"Frank Hickman" <fhickman3_NOSP@M_noblesoft.netwrote in message
news:Oc*************@TK2MSFTNGP05.phx.gbl...
"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:O9**************@TK2MSFTNGP02.phx.gbl...
>>
"Anonymous" <no******@here.comwrote in message
news:DP*********************@bt.com...
>>Is it possible to have an ATL project that also contains win32 exported
classes and functions?.
I have a project (module) that needs to export/expose a few ATL objects,
however, other modules depend on the existing exported C++ classes. I
have been adviced that to export the ATL COM object, I should do the ff:
1). Create an ATL project
2). Move the existing code to it
I would like to know if the new project can still export its
classes/functions, so that other dependent code can continue to work?
You can't export C++ classes (This isn't a restriction of ATL, but a
general issue that Windows has no universal ABI for C++ classes), but if
you have exported functions you can still do so.
Yes C++ classes can be exported. Albeit not in the since that all
functionality is exposed but it is possible.
These things are safe for sharing C++ code:
Source code.
C-compatible exported functions, with a header with appropriate
declarations, and POD structs.
object v-tables, with either a header with pure interface declarations, IDL,
or a COM type library.
For the latter two you must respect memory ownership and always deallocate
in the same module which performed the allocation.
Anything else is highly compiler-specific, non-portable, and almost certain
to cause trouble with a compiler upgrade.
>
--
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.