Call APIs without Declare Statements

OnErr0r
09-04-2003, 10:58 PM
Find included a VB class wrapper that wraps the functionality of an ASM DLL. This dll (source included) simply pushes parameters on the stack and then calls a function pointer. Only the stdcall calling convention is supported.

It's much safer to use Declare Statements in VB code, so I wouldn't suggest using this unless you have some specific reason, and know what you're doing.

Care should be taken in passing the right number of parameters. Also, you'll need to understand the difference between ByVal and ByRef. Note that strings in some cases are passed Byref, when a buffer is needed, as is the case with GetWindowsDirectory.

Mathimagics
10-16-2003, 08:41 PM
Can I download ring tones to it? I'd like to hear "You Shook Me All Night Long" when I make cdecl calls ;)

OnErr0r
10-17-2003, 10:29 AM
Ask and you shall recieve! A special thanks to MathImagics for prompting me to add CDecl calling convention. And for helping me test it. :)

I added a call to wsprintf, which uses the C (_cdecl) calling convention, not the "standard" _stdcall.

Note: If you use the wrong calling convention, you should see a "Bad DLL Calling Convention" error. However, this is not always the case.

Mathimagics
10-18-2003, 11:57 PM
This little DLL is an absolute smash hit with me! That it does cdecl AND gives dynamic loading makes my job of deploying GMP and MPFR (which are both HBNCL's **, btw) just so much easier.

With this, I achieved possibly (in fact, probably) the first direct VB to MPFR interface ever, just today. :D

And in just a few hours of testing, I've made a half-billion (yes) cdecl calls through it. As long as I get the params right it just hums ;)

Great work, OnErr0r :cool:

** HBNCL = Humungously Big Number Crunching Library

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum