需要在C#中发送指针 [英] need to send a pointer in C#

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

问题描述

我需要将一个指针值发送给一个函数:(这就是它所期望的价值。


BaseEffect.SetValue(Microsoft.DirectX。 Direct3D.Eff ectHandle,void *,

int)


问题是无效*部分。


我想发送一系列花车,但是编译器不喜欢它。

无论如何我可以推动它而不必诉诸不安全?

I need to send a pointer value to a fuction :( This is what it is
expecting.

BaseEffect.SetValue(Microsoft.DirectX.Direct3D.Eff ectHandle, void*,
int)

The problem is the void* part.

I''m tring to send an array of floats but the compiler doesn''t like it.
Anyway I could push it through without having to resort to "unsafe"?

推荐答案

无论如何,我可以推动它而不必诉诸不安全?
Anyway I could push it through without having to resort to "unsafe"?




不,你总是需要使用指针不安全。


Mattias


-

Mattias Sj?gren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop .COM

请仅回复新闻组。



No, you always need unsafe to use pointers.

Mattias

--
Mattias Sj?gren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


" Mattias Sj?gren" <毫安******************** @ mvps.org>在消息中写道

news:ul ************** @ TK2MSFTNGP12.phx.gbl ...
"Mattias Sj?gren" <ma********************@mvps.org> wrote in message
news:ul**************@TK2MSFTNGP12.phx.gbl...
无论如何我可以推动它而不必诉诸不安全?
Anyway I could push it through without having to resort to "unsafe"?



不,你总是需要使用指针不安全。



No, you always need unsafe to use pointers.




这是真的吗,马蒂亚斯? IntPtr结构怎么样?


Chris。



Is that quite true, Mattias? What about the IntPtr Structure?

Chris.


这是真的吗,Mattias? IntPtr结构怎么样?
Is that quite true, Mattias? What about the IntPtr Structure?




那不是指针(不管是C#意思),它是一个

指针大小的整数。


Mattias


-

Mattias Sj?gren [MVP] mattias @ mvps .org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com

请回复到新闻组。



That''s not a pointer (not in the C# meaning anyway), it''s a
pointer-sized integer.

Mattias

--
Mattias Sj?gren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.


这篇关于需要在C#中发送指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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