# VBForums UtilityBank > UtilityBank - Components >  Stdcall wrapper for libfftw3-3.dll

## Ben321

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.

----------


## Ben321

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.

----------


## si_the_geek

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'.

----------


## Ben321

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

----------


## si_the_geek

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).

----------


## Ben321

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

----------

