开发者

Pass 128 bits from managed C++ to C#

I have a function in a managed C++ DLL that needs to pass 128 bits back to C#. I have found quite a bit on the subject calling unmanaged C++ from C# but not so much about managed to managed calls.

This call will happen in a tight loop, potentially billions of times a day across a server farm.

What's the most efficient way to pass back the bits?

So far I considered using a GUID structure as a convenient container for the bits, but it's not clear to me whether or not the .NET runtime will GC that struc开发者_StackOverflow中文版ture, and I'm not sure if that's the most efficient mechanism.


Simply put, passing around variables of the following type defined in C++/CLI:

public value struct Int128
{
    System::Int64 lo;
    System::Int64 hi;
};

should be about the fastest you can do.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜