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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.