在c#中使用c ++ dll [英] Using c++ dll in c#

查看:72
本文介绍了在c#中使用c ++ dll的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!


我试图在c#中使用包含c ++函数的DLL,但我已经无法使用它了,这个DLL是一个名为LOOX Maker的软件,

这是一个图形编辑器,有很多选项我之所以想要

重用该代码所以我不需要再次编程,我也有来源

这个程序的代码,我已经尝试了几件事,但我没有

获得它。

有人有更多在这类事情上的经验可以帮助我吗?

我可以将项目发送到我尝试使用它的地方以及

DLL和LOOX Maker的源代码,我希望有人可以帮助我。


***通过Developersdex发送 http://www.developersdex.com ***

Hello!

I am trying to use a DLL that contains c++ functions in c# but I have
not been able to make it, this DLL is of a software called LOOX Maker,
which is a graphic editor that has many options reason why I want to
reuse that code so I not to have to program it again, also I have source
code of this program, I have tried several things but I have not
obtained it.
Somebody that has more experience in this type of things can help me?
I can send the project to you where I am trying to use it and also the
DLL and source code of LOOX Maker, I hope that somebody can help me.

*** Sent via Developersdex http://www.developersdex.com ***

推荐答案

Juan Martinez写道:
Juan Martinez wrote:
您好!

我正在尝试使用一个有限公司的DLL在c#中使用c ++函数,但我有
Hello!

I am trying to use a DLL that contains c++ functions in c# but I have



< snip>


当你说C ++ functions时,你的意思是暴露C ++类或者

你的意思是暴露正常的dll入口点(函数),而dll是用C ++编写的



第一个我不知道怎么做(或者即使它可能),第二个

可以使用DllImport属性来完成。


-

Lasse V?gs?ther Karlsen
http://www.vkarlsen.no/

mailto:la *** @ vkarlsen.no

PGP KeyID: 0x2A42A1C2


<snip>

When you say "C++ functions", do you mean "exposes C++ classes" or do
you mean "exposes normal dll entry points (functions), and the dll is
written in C++" ?

The first I have no idea how to do (or even if its possible), the second
can be done using DllImport attributes.

--
Lasse V?gs?ther Karlsen
http://www.vkarlsen.no/
mailto:la***@vkarlsen.no
PGP KeyID: 0x2A42A1C2


Juan Martinez写道:
Juan Martinez wrote:
你好!

我试图使用包含c ++函数的DLL c#但我有
Hello!

I am trying to use a DLL that contains c++ functions in c# but I have



< snip>

当你说C ++ functions时,你的意思是暴露C ++类吗?或者

你的意思是暴露正常的dll入口点(函数),而dll是用C ++编写的



第一个我不知道怎么做(或者即使它可能),第二个

可以使用DllImport属性来完成。


-

Lasse V?gs?ther Karlsen
http://www.vkarlsen.no/

mailto:la *** @ vkarlsen.no

PGP KeyID: 0x2A42A1C2


<snip>

When you say "C++ functions", do you mean "exposes C++ classes" or do
you mean "exposes normal dll entry points (functions), and the dll is
written in C++" ?

The first I have no idea how to do (or even if its possible), the second
can be done using DllImport attributes.

--
Lasse V?gs?ther Karlsen
http://www.vkarlsen.no/
mailto:la***@vkarlsen.no
PGP KeyID: 0x2A42A1C2


Hello
Hello
我试图在c#中使用包含c ++函数的DLL,但我没有
能够成功,
I am trying to use a DLL that contains c++ functions in c# but I have
not been able to make it,



有什么问题?什么使你无法成功?


如果它是一个COM dll,那么你可以将它作为你的项目的参考添加它和

包装类将生成。或者你可以用手使用COM互操作。


如果它是C dll,那么你需要互动你感兴趣的功能

这样的东西:

[DllImport(" ntdll.dll")]

public static extern IntPtr memcpy(IntPtr dst,IntPtr src,int count);

-

致以最诚挚的问候,

Andrew


What is wrong ? What made you unable to make it ?

If it''s a COM dll, then you can add it as a reference to your project and
wraper classes will be generated. Or you can use COM interop by hands.

If it''s a C dll, then you need to interop functions of your interest
something like this:
[DllImport("ntdll.dll")]
public static extern IntPtr memcpy(IntPtr dst, IntPtr src, int count);
--
With best regards,
Andrew


这篇关于在c#中使用c ++ dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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