views:

509

answers:

2

I have a ATLCOM project migrated from VC6 to VS2008. My question is, how do I build the ps dllon VS 2008?

New ATL projects in VS2008 have a separate PS project which builds the ps dll. But the migration from VC6 did not create this project.

I tried to invoke nmake on the ps mk file but that gives a redefinition error for an enum type which exists in both our source file as well as an automatically included windows header file. In the solution we fixed this by defining the WIN32_LEAN_AND_MEAN preprocessor which excludes unnecessary header files. Can I do the same while using nmake?

Is there any other way of creating the ps dll?

A: 

It's been a while since I've done it, and even then I haven't had any up to date instructions, but looking back at the project now I'll try to reconstruct the process:

  1. Make a new empty DLL project for the PS. No MFC or ATL is needed.
  2. Add the following files to the project: _proj__h.h, _proj__i.c, _proj__p.c, proj.def, dlldata.c
  3. In the project settings, add the following libs to the additional dependencies: rpcndr.lib, rpcns4.lib, rpcrt4.lib
  4. In the project settings, specify the def file as your module definition file.
  5. In the project settings, set "Generate stubless proxies" as Yes.
  6. In the project settings, set the tlb file as the one generated by the server project

This is what I could get from postmorteming a project of mine. I might have skipped some steps, and there might be a better way to do that. OTOH, I haven't had any problems with the generated PS, and you might be able to fill the gaps as you go. If you do try this and find any misses, please add a comment for future reference.

eran
Thanks Eran. Can you tell me where to find Generate stubless proxies in settings?
Bobby Alexander
Another thing, what is the type of project to be created? There is no empty dll project. The only one is an MFC dll project.
Bobby Alexander
The "Generate stubless proxies" is in the MIDL general settings. To create an empty DLL project, start with choosing a Win32 application, and on the application settings page set the type as DLL. Good luck!
eran
I cant find 'Generate stubless proxies' anywhere! There is no 'MIDL general settings'.
Bobby Alexander
A: 

Eran's suggestions seem logical but I was not able to find some of the items he was talking about. So I tried a different approach.

I created an Empty ATL (Server) project in VS 2008. This automatically creates a ps project along with the normal atl project.

I copied the vcproj file for the ps project into my project folder and renamed it to myprojectnameps.vcproj.

Then I opened my solution and added the newly copied project to it. I renamed the project (in VS 2008) to myprojectnameps and removed all the files that were already included in it.

Next I included my _i.c, _p.c, dlldata.c and the .def file into the project. In the settings under Linker > Input > Module definition file, I added my def file name.

That's it! Worked like a charm.

Bobby Alexander