v2: Implementing c++ interface callback in C#

97 views
Skip to first unread message

@lx

unread,
Oct 25, 2010, 11:36:32 AM10/25/10
to slimdx-devel
Hi all,
I have just released the code to implement the C++ interface callback
in C# for SlimDX2. I have slightly modified the generator in order to
generate empty interfaces for interfaces callback.

You can have a look at an example of implementation here for the
ID3DInclude interface :
http://code.google.com/p/slimdx/source/browse/branches/v2/SlimDX2/Sources/SlimDX2.D3DCompiler/Extension/Include.cs

I have just posted an article on my blog about it :
http://code4k.blogspot.com/2010/10/implementing-unmanaged-c-interface.html

This demonstrate where we still need to handle some code manually
after the generator, although you can see that It's fairly simple and
straightforward. Because there are not so many callbacks to implement,
they will be probably implemented like this.

Promit Roy

unread,
Oct 25, 2010, 12:33:54 PM10/25/10
to slimdx...@googlegroups.com
You have a small bug:
You must manually keep the delegate from being collected by the garbage collector from managed code. The garbage collector does not track reference to unmanaged code.

You'll need to host the delegates permanently inside the IncludeCallback class.

-- Promit



--
You received this message because you are subscribed to the Google Groups "slimdx-devel" group.
To post to this group, send email to slimdx...@googlegroups.com.
To unsubscribe from this group, send email to slimdx-devel...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/slimdx-devel?hl=en.


Alexandre Mutel

unread,
Oct 25, 2010, 1:07:08 PM10/25/10
to slimdx...@googlegroups.com
oops indeed! ;)
To unsubscribe from this group, send email to mailto:slimdx-devel%2Bunsu...@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/slimdx-devel?hl=en.

Start Fliar

unread,
Feb 25, 2014, 2:58:53 AM2/25/14
to slimdx...@googlegroups.com, alexand...@yahoo.fr
i'm interested but the source is not available any more, could you send me one copy of that, thx.

在 2010年10月25日星期一UTC+8下午11时36分32秒,@lx写道:
Reply all
Reply to author
Forward
0 new messages