Results 1 to 2 of 2

Thread: [VB6] DLL for Unsigned Long & Integer Arithmetic

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    [VB6] DLL for Unsigned Long & Integer Arithmetic

    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.
    Attached Files Attached Files

  2. #2

    Thread Starter
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: [VB6] DLL for Unsigned Long & Integer Arithmetic

    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.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width