Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

[VB6] DLL for Unsigned Long & Integer Arithmetic

dilettante

PowerPoster
Joined
Feb 5, 2006
Messages
20,939
Title

UArith.dll: A small DLL written in C to provide unsigned arithmetic for VB6 programs.

Pointer Arithmetic and similar threads and posts all over propose any number of solutions for the problem of unsigned integer arithmetic in VB6. Some of them even work... in some cases. This DLL is meant to deal with the issue by brute force, i.e. giving in and doing it in C.

Description

Four trivial functions with these signatures in VB6:

Code:
Public Declare Function UIntAdd Lib "UArith.dll" ( _
    ByVal Augend As Integer, _
    ByVal Addend As Integer) As Integer

Public Declare Function UIntSub Lib "UArith.dll" ( _
    ByVal Minuend As Integer, _
    ByVal Subtrahend As Integer) As Integer

Public Declare Function ULongAdd Lib "UArith.dll" ( _
    ByVal Augend As Long, _
    ByVal Addend As Long) As Long

Public Declare Function ULongSub Lib "UArith.dll" ( _
    ByVal Minuend As Long, _
    ByVal Subtrahend As Long) As Long

Feature list

Just those four functions.

Full source and precompiled binary included, along with two VB6 projects' source code for test/demo purposes.

Author name

Bob Riemersma

System requirements

Nominally requires Windows XP SP2 or later as compiled. Tested and working on Windows XP SP3, Windows Vista SP2, and Windows 7 SP 1.

Recompiling this DLL requires Microsoft Visual C/C++ compiler tools, at least the command line compiler environment.

License info

This software is released into the Public Domain. It may be used for any purpose as is or in derivative works. No warranty of fitness or merchantability and no support is offered. This source and binary code is AS IS.

Usage

See the ReadMe.txt file for details. Basically you put the DLL somewhere in your application's DLL Search Path. See:

Dynamic-Link Library Search Order

Then you can use the Declare statements above in your program.
 

dilettante

PowerPoster
Joined
Feb 5, 2006
Messages
20,939
Small update.

Additional functions have been included to provide left and right logical and arithmetic shifts and logical rotates on Integer and Long values. This barely changes the size of the compiled DLL since these are also tiny functions that do very little... just things we don't have handy VB6 operators for.
 
Top