Advertisement

Help linking ASM function with VB

Started by February 12, 2000 05:40 AM
5 comments, last by Freeride Designs 24 years, 7 months ago
Hi, I am programming in VB with DirectX, and I can also do ASM with DirectX (using MASM), what I want to know is if I have my VB DX program and have written an alpha blending or bltting function in ASM DX, how can I get my VB program to use this function using the surfaces created on the VB program. Sorry if I''ve explained this badly, please help Freeride Designs http://freeridedesigns.cjb.net
----------------
Black Edge Games
----------------
You must put your ASM routine in a DLL so that VB can find it at runtime. You must also make sure to make an interface for the code so that VB can call the function.

I don''t know how to do that though. =(
Advertisement
Thanks, does anybody know how I do this then???
----------------
Black Edge Games
----------------
I do not think there is any better way, so go to http://www.chez.com/scribe or http://members.xoom.com/vba51 and go to the assembler section.
Have as an argument to your asm function a pointer to the surface. Declare your function with stdcall calling convention (or is it cdecl? I can''t remember which one off the top of my head, but VB only interfaces happily with one or the other.) Make a DEF file for your ASM object and link them into a DLL. Use the VB help files to determine how to write a Declare statement for your function, and you should be set.
It is STDCALL that VB accepts, cdecl uses the C/C++ convention. The reason that VB can only take stdcall is because it has to use the windows api dlls (which use stdcall) to interface dlls.

-Omalacon
Advertisement
You can call me stupid all you want, but I think I did use cdecl in one of my test functions for a dll and it worked as long as you included some weird characters. Try to do it and then look through the Depends viewer. (In the VB6 CD)

All I did was compile a sample dll that was generated by Developer Studio.

This topic is closed to new replies.

Advertisement