문제

Has anyone used SharpGen (from SharpDX) for generating wrappers in other projects than SharpDX itself? I wan't to decide whether to use SharpGen or Swig to generate a wrapper for a C++ library.

The generated Code created by SharpGen seems to be fast (as SharpDX is known as the fastest DirectX-Wrapper in the managed world). But there is not much documantation for SharpGen out there. On the other hand Swig is better documented but might not be optimized as SharpGen for speed and I don't need the muli-language generation feature (only C#/.Net is required at this point). Any experiences to share?

도움이 되었습니까?

해결책

SWIG is a well documented general purpose interop wrapper, while SharpGen is indeed an internal tool used in SharpDX that is specifically designed to work on C++ COM interface (or C++ classes with virtual pure methods). While SWIG needs to compile a C++ stub, SharpDX is performing the whole interop fully from .NET (so you have the benefits of AnyCPU). SharpGen has not been packaged to be used easily outside SharpDX build, but the tool in itself can be used without SharpDX, though It will require to dig into existing mapping files to know how to configure it (an example here)

Unless you have some specific requirements, I would stick with SWIG as it is well documented. SharpGen is more suitable to a developer that is already using SharpDX and would want to access its own custom C++ COM object.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top