0

I need to be able to write a DLL in either C# or VC++ that is accessible from code that is written in Visual Studio 2003 VC++. It looks like the code is unmanaged (uses * for pointers) VC++ and this DLL needs to be able to drop right in and be accessed by the current code.

The DLL is an RS232 driver that needs to be able to return an int for an error code and pass back, by reference, some measured values, to the calling program.

Will I even be able to write this in C#? If not, I only have access to Visual Studio 2005 or 2008. Will I be able to write my code in either, and will that DLL be able to be called from the current code base? Or do I have to go looking on ebay for a copy of VS 2003?

4

1 に答える 1

0

VS2008/2005 で C/C++ で作成されたアンマネージ DLL は、VS2003 C/C++ プロジェクトでコードを呼び出しても問題なく動作するはずです。それはまた、おそらく最も抵抗の少ない道でもあります。DLL が、VS2003 で利用できない可能性が高い他の DLL を参照している場合は、可能であればそれらを再配布するか、そうでなければ静的にリンクしてください。

マネージ DLL も可能ですが、マネージ/アンマネージ ギャップを埋めるために少しのグルー コードが必要になります。VS2003 がサポートする .NET ランタイム バージョン (1.1) をターゲットにしてください。

于 2010-05-26T07:13:38.517 に答える