Building Proxy/Stub dll in VS 2008

江枫思渺然 提交于 2019-12-10 20:45:51

问题


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?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/1047656/building-proxy-stub-dll-in-vs-2008

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!