开发者

Making a DLL in VB.NET which I can use as DllImport

Can I make a DLL in VB.NET w开发者_运维知识库hich I can use in VB.NET with the tag DllImport just like we import functions from "user32.dll"?


No you can't.

The DllImport attribute is used to invoke native / un-managed functions from managed code - VB.Net is managed not native, and so you can't run VB.Net functions through DllImport / P/Invoke.

To use VB.Net functions in other VB.Net projects you should either add a reference to that assembly, use a common referenced interface or base class, or use Reflection.


The outcome of your project, so when you compile and for example debug it are libraries.

  • 1 : Go into Visual Studio
  • 2 : Create a new Project -> "Class Library"
  • 3 : Put some code into your classes
  • 4 : Build it
  • 5 : Search the Debug/Release folder for your DLL
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜