ATL project with Win32 DLL exported functions

A

Anonymous

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?
 
D

David Lowndes

Is it possible to have an ATL project that also contains win32 exported
classes and functions?.

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

Dave
 
B

Ben Voigt [C++ MVP]

Anonymous said:
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.
 
F

Frank Hickman

Ben Voigt said:
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.

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

Ben Voigt [C++ MVP]

Frank Hickman said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top