Groups | Blog | Home
all groups > visual c > october 2007 >

visual c : ATL project with Win32 DLL exported functions


Anonymous
10/29/2007 12:00:00 AM
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
David Lowndes
10/29/2007 12:00:00 AM
[quoted text, click to view]

If you're asking: can an ATL DLL expose exported functions as well as
its normal COM object(s), the answer is yes.

Ben Voigt [C++ MVP]
10/29/2007 11:45:50 AM

[quoted text, click to view]

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.

Frank Hickman
10/29/2007 12:37:26 PM
[quoted text, click to view]

Yes C++ classes can be exported. Albeit not in the since that all
functionality is exposed but it is possible.

--
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.

Ben Voigt [C++ MVP]
10/29/2007 1:24:17 PM

[quoted text, click to view]

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.

[quoted text, click to view]

AddThis Social Bookmark Button