在 VS 2008 中构建 Proxy/Stub dll

发布于 2024-07-25 02:02:45 字数 334 浏览 3 评论 0原文

我有一个 ATL COM 项目从 VC6 迁移到 VS 2008。如何在 VS2008 上构建 PS DLL?

VS 2008 中的新 ATL 项目有一个单独的 PS 项目,用于构建 PS DLL。 但从VC6迁移并没有创建这个项目。

我尝试在 PS mk 文件上调用 nmake,但这给出了我们的源文件以及自动包含的 Windows 头文件中存在的枚举类型的重新定义错误。 在解决方案中,我们通过定义 WIN32_LEAN_AND_MEAN 预处理器来修复此问题,该预处理器排除不必要的头文件。 我可以在使用 nmake 时做同样的事情吗?

还有其他方法可以创建 PS DLL吗?

I have a ATL COM project migrated from VC6 to VS 2008. How do I build the PS DLL on VS2008?

New ATL projects in VS 2008 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 that 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

愛上了 2024-08-01 02:02:45

埃兰的建议似乎很合乎逻辑,但我无法找到他正在谈论的一些项目。 所以我尝试了一种不同的方法。

我在 VS 2008 中创建了一个空的 ATL(服务器)项目。这会自动创建一个 ps 项目以及正常的 atl 项目。

我将 ps 项目的 vcproj 文件复制到我的项目文件夹中,并将其重命名为 myprojectnameps.vcproj。

然后我打开我的解决方案并将新复制的项目添加到其中。 我将项目(在 VS 2008 中)重命名为 myprojectnameps 并删除了其中已包含的所有文件。

接下来,我将 _i.c、_p.c、dlldata.c.def 文件包含到项目中。 在链接器>下的设置中 输入> 模块定义文件,我添加了我的def文件名。

就是这样! 工作起来就像一个魅力。

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.

土豪 2024-08-01 02:02:45

我已经有一段时间没有完成它了,即使如此,我也没有任何最新的说明,但现在回顾该项目,我将尝试重建该过程:

  1. 为 PS 制作一个新的空 DLL 项目。 不需要 MFC 或 ATL。
  2. 将以下文件添加到项目中:proj_h.h、proj_i.c、proj_p.c、proj.def, dlldata.c
  3. 在项目设置中,将以下库添加到附加依赖项中: rpcndr.lib、rpcns4.lib、rpcrt4.lib
  4. 在项目设置中,将 def 文件指定为模块定义文件。
  5. 在项目设置中,将“生成无存根代理”设置为“是”。
  6. 在项目设置中,将 tlb 文件设置为服务器项目生成的文件。

这是我可以通过事后分析我的项目得到的结果。 我可能跳过了一些步骤,并且可能有更好的方法来做到这一点。 OTOH,我生成的 PS 没有任何问题,您也许可以随时填补空白。 如果您尝试此操作并发现任何遗漏,请添加评论以供将来参考。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文