vb 6调用C#Static Library [英] vb 6 call C# Static Library

查看:67
本文介绍了vb 6调用C#Static Library的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C#中编写静态方法,我想在vb6中调用静态库,但我无法调用它。

任何人都可以给我解决方案吗?感谢高级

I write Static Method in C# and i want to call Static Library in vb6, but I can't call it.
could any one give me the solution? thank in advanced

推荐答案

没有.NET静态库这样的东西。这个问题毫无意义。



如果您创建并注册COM组件,则可以在本机(非托管)项目中重用CLI代码。请参阅:

http://msdn.microsoft.com/en-us /library/c3fd4a20.aspx [ ^ ],

http://msdn.microsoft.com/en -us / library / w29wacsy.aspx [ ^



另请参阅: http://en.wikipedia.org/wiki / Component_Object_Model [ ^ ]。



从.NET的角度来看,COM是一种非常过时的技术,旨在为其他不兼容的软件平台和语言带来一些面向对象的功能和互操作性(VB6就是其中一个例子)过时的非OOP系统)。注册COM组件是一种令人不快的麻烦和潜在的系统污染。有一种更清洁的方法,但使用它要复杂得多。已经开发了一些自动化方法并作为CodeProject文章呈现。请查看我过去的答案,我将简要介绍它们并提供原始文章的链接:

在MFC中加载C#DLL [ ^ ],

如何在Visual Basic 6.0中使用在Visual Basic 2008中创建的dll [ ^ ],

从无人码VC ++中调用用C#编写的托管DLL [ ^ ],

API在.Net:托管代码或非托管代码 [ ^ ]。



现在,您是否希望对所有远离您的应用需求的基础设施问题感到厌倦?在我看来,完全切换到.NET将更容易,更有用。 :-)



-SA
There is no such thing as .NET static library. The question makes no sense.

You can re-use CLI code in native (unmanaged) projects if you create and register a COM component. Please see:
http://msdn.microsoft.com/en-us/library/c3fd4a20.aspx[^],
http://msdn.microsoft.com/en-us/library/w29wacsy.aspx[^].

See also: http://en.wikipedia.org/wiki/Component_Object_Model[^].

From the .NET perspective, COM is a pretty much obsolete technology created to bring some object-oriented features and interoperability to otherwise incompatible software platforms and language (VB6 is one of the examples of such obsolete non-OOP systems). Registration of a COM component is an unpleasant hassle and a potential system contamination. There is a cleaner method, but using it is considerably more complex. Some automated approaches have been developed and presented as CodeProject articles. Please see my past answers where I overview them in brief and provide the links to original articles:
loading C# DLL in MFC[^],
How can I use a dll created in Visual Basic 2008 in Visual Basic 6.0[^],
Call Managed DLL written in C# from Unmanged Code VC++[^],
API's in .Net: Managed or UnManaged Code[^].

Now, do you want to get bored will all that infrastructural issues which are far from your application needs? In my opinion, switching to .NET completely would be easier and much more useful. :-)

—SA


这篇关于vb 6调用C#Static Library的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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