» Home » VB Fibre
Site
News
Files

Visual Basic
Strings
Math
General
Properties
Memory
Methods

Search
Testing

Inline ASM-VB
Strings
Math
General
Memory

Search
Using inline ASM
Submit!

Using conditional-compilation to retain code functionality in the IDE.

When using inline ASM, you are going to face one consequence: Your ASM functions won't do anything while running your code from the Visual Basic IDE.

To solve this, you can simply use conditional compilation. I never saw a use for this, until now.

It works quite simple. One constant is going to control if VB will use normal VB functions or your high-speed ASM functions!
So, if you're developping your program, simply use the VB functions.. and when you are going to compile your program to an EXE/DLL simply set the boolean to True and it will compile the ASM functions instead! (the original VB functions will be totally ignored)
Simply demonstrated using the bitshift example:

Option Explicit

#Const Compiled = True

Public Sub Main()
Dim I As Long
Dim Y As Long
Dim lngBitShift As Long
Dim lngNumber As Long, lngShift As Long

lngNumber = 8
lngShift = 3

#If Compiled Then
lngBitShift = mdlASM.asmBitShiftLeft(lngNumber, lngShift)
#Else
lngBitShift = mdlASM.vbBitShiftLeft(lngNumber, lngShift)
#End If
End Sub


User contributed notes:

Author: Randy () Date: 21:10 27/10/2004
I can program in VB and MASM and I can't seem to get your addin to work. I got the icon showing the addin is installed but the test project still says it isnt working. I have set the path correctly also.

Author: Almar Joling () Date: 21:10 27/10/2004
Do you get any errors while compiling? IS the compiler "hooked" (left-top button, I think) in the configuration?

Author: VBSmiles () Date: 04:01 02/01/2005
Maybe a little late. ( but should be well documented on this site )
I also ran into some problems, even after coming to the site.

First The dll needs to be properly registered and in the system folder. Although most should understand this , many will not. The easiest way is to complile the project into the system folder,Then open a new project.

Next, and IS documented is that it has to point to ml.exe But the site does not tell you what all those buttons and things are for. Click on the Change Settings button And you will see the screen that is also shown on this site.change the path then hit Exit Settings.

Now everything is set up properly ( almost )
If you attempt to hook the project you will get an error still... this is because you have to actually save your new project files before hooking into it.

So you can do now if you want.. with no code just to be sure it works. File | Save as , and save the project wherever you want.

Now you should be able to hook the project.

Although I have yet to actually do some inline asm, I also suspect that you must save whatever you add to the project before compilation ( and probably should be done anyway, as good programming practice )

To Almar Joling:
I understood you don't really have time for the inline asm stuff, but there are many things that should be better explained. particulularly with using the dll itself... It's possible that I just havent read enough of the site. But information.

It would ease yourself from all the questions you probably get. And make things easier on people trying to set the thing up.

Insert Template
ML & Link /?
Delete Log Folder
Make Cfg File
Many of the things within Change Settings

Alot of these things should be explained in detail on the main help pages on this site.

Again I, myself am only just getting started with inline asm, so I probably just need to look at more of the site.Yet that first page can definatily use some refinement.
Just my 2 cents :)

Author: Tom (hurendo_kun at hotmail dot com) Date: 05:09 23/09/2005
ThunderVB is the way to go. ;)

Add user-note
Author:
E-mail (optional):
Anti spam, please enter 'ok' without quotes:
Comment: