如何使用从托管可执行文件加载的本机dll中的资源 [英] How to use resources in a native dll loaded from a managed executable

查看:90
本文介绍了如何使用从托管可执行文件加载的本机dll中的资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我已将MFC Visual Studio 2010 C ++应用程序转换为DLL,以将其功能公开给托管的C#应用​​程序. dll中的本机代码仍将字符串保留在字符串表中.公开的函数运行良好,直到到达第一个LoadString函数以从字符串表中获取字符串为止.有没有一种方法可以在托管应用程序中调用的dll中的本地代码中使用资源?感谢您提供任何提示.

Hello, I''ve turned an MFC Visual Studio 2010 C++ application into a DLL to expose its functionality to a managed C# application. The native code in the dll still keeps strings in a string table. The exposed functions run well untill the first LoadString function is reached to get a string from string table. Is there a way of using resources in native code situated in a dll, called from a managed application? Thanks for any hints.

推荐答案

您可以使用 P/调用 [ ^ ]访问DLL的功能.但是,将DLL中的所有资源正确地编组并返回给.NET应用程序也很重要.
You can use P/Invoke[^] to access the functions of the DLL. However it is also important that any resources from the DLL are correctly marshalled and returned to the .NET application.


这篇关于如何使用从托管可执行文件加载的本机dll中的资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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