Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / October 2007

Tip: Looking for answers? Try searching our database.

ATL project with Win32 DLL exported functions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Anonymous - 29 Oct 2007 07:38 GMT
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?
David Lowndes - 29 Oct 2007 08:47 GMT
>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
Ben Voigt [C++ MVP] - 29 Oct 2007 17:45 GMT
> Is it possible to have an ATL project that also contains win32 exported
> classes and functions?.
[quoted text clipped - 8 lines]
> 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.
Frank Hickman - 29 Oct 2007 18:37 GMT
>> Is it possible to have an ATL project that also contains win32 exported
>> classes and functions?.
[quoted text clipped - 12 lines]
> 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.

Signature

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

Ben Voigt [C++ MVP] - 29 Oct 2007 19:24 GMT
>>> Is it possible to have an ATL project that also contains win32 exported
>>> classes and functions?.
[quoted text clipped - 15 lines]
> 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.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.