Solved

A few simple ATL DLL Questions

Posted on 2003-12-05
2
641 Views
Last Modified: 2013-12-14
Hi, a couple of questions relating to ATL (COM) DLL's.  I'm moving from MFC to ATL/WTL, so I'm having to get away from MFC Extension DLLs.  Basically, most of these relate to a replacement for my happy MFC Extension DLL way.

1) What is the (myproject)PS project?  What function does it serve, and when would I need to use it?

2) With an ATL COM DLL, is there a way to export a C++ Class (for example, a derivation of CWindowImpl) from the DLL?  If so, how; if not, is there an alternate way with a different type of dll?

3) With these COM objects and such, aren't all the methods to the interface exposed to anyone wanting to look at them? Is there a way to prevent this?


I'm very new to COM, but I fear it's something that will not go away.  Any tips would be *greatly* appreciated. :)  I'll split points if need be.

Thanks.
0
Comment
Question by:Shutterbug
2 Comments
 
LVL 49

Assisted Solution

by:DanRollins
DanRollins earned 50 total points
ID: 9887827
1) I don't know.  Where did you see it?  Provide a context.
2) Yes.  Use the ClassWizard to create and object publish its methods and properties via the IDL.  But it is probably easiest to just export normally, via a shared header (standad DLL exporting).
3) The direct interfaces... yes.  But let's say that the first parameter to a method is a long int.  Nobody knows that if that integer is set to 0x27856, the program performs some magic, undocumented operation.
-- Dan
0
 
LVL 9

Accepted Solution

by:
_ys_ earned 100 total points
ID: 9896083
1) This project allows you to compile a custom proxy/stub dll. If you don't know what these are, chances are you don't need them. Feel free to ignore this project.

2) As DanRollins pointed out, yes. But be careful. A COM dll can be unloaded by the COM runtime whenever it's not using it - this would result in some nasty dangling references to instances of your exported classes.

3) But this is one of the points to, and benefits of, COM - exposing objects via interfaces. If you do want to hide any interfaces, remove them from the IDL - thus excluding them from the type library. Of course, in this situation, you would have to declare those interfaces elsewhere.

struct IMyInterface
{
    __stdcall HRESULT myMethod1 ( ) = 0;
    __stdcall HRESULT myMethod2 (int) = 0;
};

// {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}
const GUID IID_IMyInterface =
{ 0xXXXXXXXX, 0xXXXX, 0xXXXX, { 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX } };
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question