DllImport in .NetCore [英] DllImport in .NetCore

查看:417
本文介绍了DllImport in .NetCore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将.netFramework代码移植到.NetCore(针对ubuntu 14和windows),该代码具有dllimport(" kernel32.dll")。问题是当我们依赖于这些dll(原生于windows /任何平台)时,移植代码如何在其他平台上运行? 

I have to port .netFramework code which has dllimport("kernel32.dll") to .NetCore(targeting ubuntu 14 and windows). Question is when we have dependency on such dlls (native to windows /any platform) how the ported code will work on other platforms? 

这些dll依赖项需要由ubuntu特定的替换在我的情况下?便携性将会中断。 

Such dll dependencies need to be replaced by ubuntu specific in my case? then portability will break. 

任何想法如何解决这个问题,提前谢谢。

Any ideas how to address this, thanks in advance.

推荐答案

据我所知,也许您需要检查您正在使用的系统,然后使用:

As far as I see, Maybe you need to check which system you are using, and then use:

1 )if ...... else if else来决定是否应该执行这些DLLIMPORT代码的逻辑。

2)使用条件编译#define ......

请注意Microsoft发布"Core"的原因。是微软希望在全世界的系统上制作.NET。因此,仅适用于Windows的许多功能将被忽略或删除。 .NET Core似乎比传统的.NET框架要少。

Notice that the reason why Microsoft publishes "Core" is that Microsoft wanna make .NET all over the world on the systems. So Many features ONLY for Windows are ignored or removed. And .NET Core seems less than the traditional .NET framework.


这篇关于DllImport in .NetCore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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