具有类成员的dllimport [英] dllimport with a member of a class

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

问题描述

你好

任何人都可以在以下主题上为我提供帮助:

please could anybody help me with the following topic:

我有一个dll(非托管代码),它提供了以下功能:

i have a dll (unmanaged code) which provides for example this function:

公共:void __thiscall DLLNameDll :: CTMGDeviceSetup :: Close(void)0x10011028 0x00011028 2(0x2)DLLName.dll C:\ folder \ Debug \ DLLName.dll导出函数

如果我想在托管的C#项目中使用它,则尝试使用以下导入:

if i want to use it in a managed C# Project, i try to use the following import:

[DllImport("DLLName.dll",EntryPoint ="Close",CharSet = CharSet.Unicode)]

[DllImport("DLLName.dll", EntryPoint = "Close", CharSet = CharSet.Unicode)]

公共静态外部变量void Close();

public static extern void Close();

推荐答案

Buchner Josef,您好

Hi Buchner Josef,

谢谢您在这里发布.

对于您的问题,托管男女可以通过两种方式调用非托管代码.

For your question, there are two ways of managed coed to call unmanaged code.

以下是一些示例供您参考.

Here are some examples for your reference.

http://stackoverflow.com/questions/18374667/calling-unmanaged-code -from-managed-code

http://stackoverflow.com/questions/16332701/how -to-call-c-dll-in-c-sharp

http://stackoverflow.com/questions/16332701/how-to-call-c-dll-in-c-sharpI hope this would be helpful.

最好的问候,

温迪


这篇关于具有类成员的dllimport的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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