官术网_书友最值得收藏!

  • .NET Core 2.0 By Example
  • Rishabh Verma Neha Shrivastava
  • 222字
  • 2021-06-24 18:31:02

Interop with existing native and Mono libraries

Code reusability is one of the key principles in programming. For example, in an application we may use a certain functionality multiple times, so we keep it in a useful place and refer it from that place, whenever we need it in our application. Now, suppose our application implemented some common functionality which we can use in other applications, in this case, instead of writing the same logic again, we can create a library. It is easily distributable and reusable.

Asp.NET Core supports cross-platform programming, so any Linux user who has built many reusable libraries, API-like console support, and filesystem access, and wants to use them while writing code in ASP.NET Core, can access them. In this section, we will see how to access these native libraries (.dll) and Mono libraries (.so) in the program.

Common Language Infrastructure (CLI) helps to interoperate with existing code. We need to handle three basic problems to get things to work. First, where and how to specify the library, second, determining which function we want to invoke, and third, passing parameters. Common Language Runtime (CLR) provides Platform Invocation services—we call it P/Invoke. It enables managed code to call C, C++ functions in native libraries (DLLs). Let's discuss what Platform Invoke is and how to use it.

主站蜘蛛池模板: 岗巴县| 申扎县| 芮城县| 滨海县| 嘉祥县| 体育| 奈曼旗| 白水县| 安阳市| 阿拉善盟| 濮阳县| 乐昌市| 乌鲁木齐市| 婺源县| 南投市| 行唐县| 巴东县| 容城县| 登封市| 天门市| 介休市| 松桃| 韶关市| 七台河市| 永丰县| 皋兰县| 梅河口市| 东丽区| 嘉黎县| 宁海县| 东兰县| 合作市| 全椒县| 乌恰县| 彰武县| 繁峙县| 唐海县| 务川| 中西区| 新民市| 环江|