如何使用单个DLL支持metro和桌面样式应用程序? [英] How to support both metro and desktop style applications with a single DLL?

查看:65
本文介绍了如何使用单个DLL支持metro和桌面样式应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想引用从我的DLL中的系统库中获取的C运行时符号。例如。 errno。

I'd like to reference C runtime symbols taken from system libraries in my DLL. E.g. errno.

在桌面上,我绕过GetModuleHandle()查找当前加载的运行时库,然后找到
< span style ="font-size:small"> GetProcAddress()
以解析errno的位置,而无需在任何导入库中进行链接。因此可以与许多版本的MS运行时有效兼容。

On the desktop I did a loop around GetModuleHandle() to find out currently loaded runtime lib and then GetProcAddress() to resolve the location of errno without a need to link in any import libraries. Thus being effectively compatible with many versions of MS runtimes.

我可以使用metro应用程序执行相同操作吗?我在地铁中看到了上面的Get *()  API。



我应该创建一个单独版本的DLL以支持地铁,我能够支持所有可能的WinRT版本而不实际链接到它们?

谢谢。

May I do the same with metro app? I saw the above Get*() APIs are forbidden in metro.

Should I create a separate version of my DLL to support metro and will I be able to support all possible incarnations of WinRT without actually linking to them?
Thanks.

推荐答案

首先,我想要确保你遇到了Martyn Lovell的演讲,该演讲讨论了Metro风格应用的平台版本故事。这可能会回答您的一些问题。

To start, I want to make sure you have run across Martyn Lovell's talk which discusses the platform versioning story for Metro style apps. This may answer some of your questions.

围绕Windows运行时

PLAT-874T
<发言人:Martyn Lovell

Lap around the Windows Runtime
PLAT-874T
Speakers: Martyn Lovell

GetModuleHandle的替代品将是
LoadPackagedLibrary
。  GetProcAddress
仍然可用。

The replacement for GetModuleHandle would be LoadPackagedLibraryGetProcAddress is still available.

Win32 DLL可以打包在您的Appx包中,只要它符合商店规则。 它确实不需要是WinRT组件。

A Win32 DLL can be packaged in your Appx package as well as long as it conforms to the store rules. It does not need to be a WinRT component.


这篇关于如何使用单个DLL支持metro和桌面样式应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆