CLR C++ VS C++ (pstsdk)
考虑西蒙·穆里埃 (Simon Mourier) 对这个问题的回答:
处理 Microsoft Office Outlook 2003/2007 电子邮件...
我计划使用用 C++ 编写的 PST 文件格式 SDK。
我想借此机会更多地了解 C++ 并更新它,因为距离我上次使用它已经有 15 年了。我已经下载并配置了 Boost 1.45 需要与 pstsdk
一起使用。
现在,我正在使用 CLR C++ 编写一个 Windows 窗体应用程序,并计划使用 pstsdk
读取 PST 文件。
我同时使用 CLR C++ 和纯 C++ 有什么关系吗?
我是否应该考虑以不同的方式使用它,或者这样可以吗?
Considering Simon Mourier's answer to this question:
Processing Microsoft Office Outlook 2003/2007 email messages…
I plan to use the PST File Format SDK which is written in C++.
I would take this opportunity to learn more about C++ and to renew with it, since it's been quite 15 years since the last time I used it. I have already downloaded and configured Boost 1.45 which is required to work with pstsdk
.
Now, I'm currently writing a Windows Forms application using CLR C++ and plan to use the pstsdk
to read from PST files.
Does it matter in any way that I'm using both CLR C++ and pure C++ altogether?
Shall I consider using it a different way, or is this okay?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您想使用 .NET(Windows 窗体,甚至可能是较新的 WPF)用户界面,最简单的方法是在 C++/CLI 中构建对象模型,以本机代码实现,但具有 .NET 接口。
然后用 C# 编写 UI 并调用 C++/CLI 对象模型(这与使用 .NET 基类库的区别只有一种方式——您必须添加对 C++/CLI 程序集的引用...但是 C++/ CLI 编译器将创建 C# 使用的所有元数据)。
If you want to use a .NET (Windows Forms, or maybe even the newer WPF) user interface, the simplest approach is to build an object model in C++/CLI, implemented in terms of the native code but having a .NET interface.
Then write the UI in C# and call the C++/CLI object model (which differs from using the .NET base class library in only one way -- you have to add a reference to the C++/CLI assembly... but the C++/CLI compiler will create all the metadata that C# uses).
您可以混合托管和非托管代码,但是跨边界编组除内置类型之外的所有内容将是一件痛苦的事情。使用更强大的非托管 C++ 更容易。例如,您可以使用 CodeGear C++ Builder(或 QT)。 CodeGear 的问题是编译器不是那么好,因此您将无法从 Boost 编译所有内容,但您可能不需要它。
You can mix managed and unmanaged code, but it will be a pain to marshal everything except the built-in types across the boundaries. It's much easier to stay with more powerful unmanaged C++. You could use CodeGear C++ Builder for example (or QT). The problem with CodeGear is compiler isn't that great, so you won't be able to compile everything from Boost, but you might not need that.
C++/CLI旨在与非托管 C++ 进行互操作 - 这几乎就是它的全部目的。然而,我觉得如果您需要 .NET 来实现 WPF(这是一项出色的技术),并且只需使用 C++/CLI 进行互操作,那么用 C# 编写可能会更容易。
C++/CLI is intended to interop with unmanaged C++- that's pretty much it's entire purpose. However, I feel that it's probably easier to write in C# if you need .NET for, say, WPF, which is an excellent technology, and just use C++/CLI for interop.