Inserting Asm code into a VB Dll.
What I have is this:
ActiveX DLL to do work, via an html.
Assembler code to format a large file FAST.
What the problem I have is:
A 512k text file that requires formatting before the ActiveX DLL can safely navigate it. The assembler code will do this, but, I don't want another DLL. I want to be able to hide the assembler inside the DLL (in another module?!) and be able to call it within the DLL as normal (and be able to access it dynamically). Pass parameters, etc. Since it needs to work with an in buffer and an out buffer (can get as large as a couple megs for each). Doing a 512k file in VB takes 2 minutes. Nobody in their right mind would wait that long. I want to cut it to 2 seconds or less.
The formatting is for streamlining, lowercase conversion, formatting of the data (validating it too), all in one shot. I've laid out the code in vb in a structured manner that will work with assembler (I prototyped) and should be able to write the assembler in short order (as I've written in other assembly languages before). It's just the "hooking" of the two together so they're one file and one "mind". :)
Anyone do this before that has found the best way to do this?
Actually, if you use API calls, you have been!
If you use API calls, your Declare function gets the offset in memory to the function, the call merely calls the code, presetting all the pre-requisite registers with the values needed for the call (which is as far as I know an assembler call to a jump table).
I wish that VB was a little more asm friendly.
Actually, the API calls are also random.
The DLL gets loaded into memory somewhere.
The Declare Function does a lookup on the dll it's referencing and gets the offset of the code in the library and when you do the actual call, it goes direct. (Thats why if you get the declare before someone else changes the API call by a hook, you don't get the hook.)
Just wish I could GET assembler code to run via VB, without adding another DLL for no reason. :/
I was reading up on that recently.
But lost the web address. :)
Now all I need is some aid in references to the Intel chipset instruction set for x86. Finding that is like pulling teeth on a lion with a truck. Won't seem to happen (atleast netwise).
Any ideas anyone? And anyone know of a way to force that string to stay PUT while the call happens? (So good ol' GC doesn't go "Hey, lets do some cleanup.")
:/
Assembly code in strings.
Apparently, garbage collection can happen during the course from when you get the address of the string location and when you make the call (thus moving the string in memory).
There's a way around it, just merely have to make an UGLY looking call. But apparently others have run into it. I read somewhere that the best way to avoid it is to ensure the string doesn't move by calling directly afterwards, but there's no guarantees, since once the string is made, the call can cause a pre-usage garbage collection. :( I'm still tinkering on that part.
Thanks for the two sites, I'm super busy with another project at current, that doesn't cause BSoD's, but I love when the IDE goes flop (no wait, I don't, grumble).
BSoDs are the least of my worries. :D Next I've got to start patching into system calls. (Now won't THAT be fun.)