Results 1 to 7 of 7

Thread: Stdcall wrapper for libfftw3-3.dll

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,181

    Stdcall wrapper for libfftw3-3.dll

    FFTW is the most popular FFT (fast fourier transform) component out there, but the problem is its DLL file libfftw3-3.dll uses the CDECL calling convention, while VB6 only can handle the STDCALL calling convention natively. To get around that problem, I've created a wrapper, that is a DLL file called FFTW3Wrapper.dll. I wrote it in assembly language, and assembled it in NASM and linked it in GoLink. I then wrote a module (.bas file) in VB6 that has all the needed declare statements for my wrapper DLL file. Here's the link to download the zip file that has both the DLL file (both source code and compiled) and BAS file in it, and a readme file that has important information (list of files in the zip, and copyright info, etc). It also has a .bat file in it. If you have nasm.exe, golink.exe, the asm file, and the bat file all in the same folder, just run the bat file, and it will compile the dll file for you.


    Link to download zip package for my FFTW wrapper FFTW3Wrapper.zip

    Link to official FFTW download ftp://ftp.fftw.org/pub/fftw/fftw-3.3.4-dll32.zip
    You'll need to download that zip file to get libfftw3-3.dll, or my wrapper dll won't do you any good.



    Here's what you will need if you want to compile it yourself.

    Link to official NASM download http://www.nasm.us/pub/nasm/releaseb...2.02-win32.zip
    You'll need to go here to download NASM so you can assemble the source code asm file for the wrapper, to get the obj file.

    Link to official GoLink download http://www.godevtool.com/Golink.zip
    You'll need to download GoLink so you can link the obj file, to get the dll file.
    Last edited by Ben321; Jul 30th, 2016 at 04:31 PM.

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,181

    Re: Stdcall wrapper for libfftw3-3.dll

    By the way, here's something to note. The 1st, 2nd, and 3rd dimensions are not as you might expect them to be, in FFTW. In VB6, the first dimension of a multidimensional array is the one who's coordinate changes fastest as you move through a serialized copy of the array. This corresponds to the horizontal (x) coordinate of a 2D array. In FFTW though, the first dimension is defined as the one that changes the slowest as you move through a serialized copy of the array. This corresponds to the vertical (y) coordinate of a 2D array. So when you give it the size of the first dimension for a function like PlanDFT2D, when you want to use it for image processing, don't give it the image's width. Instead, give it the image's height. And then give it the width for the SECOND dimension.

  3. #3
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,927

    Re: Stdcall wrapper for libfftw3-3.dll

    Please attach your file here, rather than on an external site.

    There are many reasons to do that, not least of which is that external sites have a habit of deleting/moving things without warning - which then makes threads like this useless.


    To add an attachment, Edit the post (and "Go advanced") then click on 'Manage Attachments'.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,181

    Re: Stdcall wrapper for libfftw3-3.dll

    Quote Originally Posted by si_the_geek View Post
    Please attach your file here, rather than on an external site.

    There are many reasons to do that, not least of which is that external sites have a habit of deleting/moving things without warning - which then makes threads like this useless.


    To add an attachment, Edit the post (and "Go advanced") then click on 'Manage Attachments'.
    I've used mediafire many times over the years for distributing my files. They are very good about NOT changing links for your downloads (unlike other similar websites). The attachment space provided by vbforums is quite limited, and I've already used a good chunk of it over the years. The space provided by mediafire is nearly UNLIMITED.
    Last edited by Ben321; Jul 30th, 2016 at 04:08 PM.

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,927

    Re: Stdcall wrapper for libfftw3-3.dll

    I'm afraid my experience over the years (after having to delete several threads like this one) is that they cause as many problems as others... which is why the sticky threads at the top of the UtilityBank tell you to attach the code. As mentioned in my previous post, the moving/deleting are not the only issues.

    As your file is very small, attaching it here is very unlikely to cause a problem for your attachment space (which does increase over time).

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Oct 2008
    Posts
    1,181

    Re: Stdcall wrapper for libfftw3-3.dll

    Quote Originally Posted by si_the_geek View Post
    I'm afraid my experience over the years (after having to delete several threads like this one) is that they cause as many problems as others... which is why the sticky threads at the top of the UtilityBank tell you to attach the code. As mentioned in my previous post, the moving/deleting are not the only issues.

    As your file is very small, attaching it here is very unlikely to cause a problem for your attachment space (which does increase over time).
    Ok, fixed.

  7. #7
    Addicted Member
    Join Date
    Jun 2017
    Posts
    236

    Re: Stdcall wrapper for libfftw3-3.dll

    hi Ben

    'Public Declare Function PlanDFT Lib "FFTW3Wrapper.dll" (ByVal DimCount As Long, ByRef DimSizes As Long, ByRef Src As Double, ByRef Dest As Double, ByVal Sign As Long, ByVal Flags As Long) As Long


    why use ByRef Src As Double, ByRef Dest As Double ??

    not ByRef Src() As Double, ByRef Dest() As Double or
    ByVal Src As Long, ByVal Dest As Long ??

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