简体   繁体   中英

Use asm in VB.NET

I wanna call some ASM functions in VB.NET. How can I do it? It's for performance purpose.

I did not find anything on the web.

Thx

VB.NET and the CLR in general don't support mixing assembly-code with CIL (it's possible, but let's just assume it isn't) in the same assembly (note that "an assembly" is the name given to a .NET executable and does not refer to "assembly code", it's confusing, I know).

You'll want to do this via interop. You'll want to compile your assembly instructions into their own native Windows DLL file, then export those functions (your assembler/linker will come with instructions on how to do this), then from within VB.NET define a static class ("Module") that has DllImport statements for each exported function from your DLL. Then it's just a matter of calling those functions.

Type conversion ("Marshalling") to native is handled for you by the CLR.

可以使用C#轻松安全地完成此操作,不知道为什么它不能与VB一起使用。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM