Hi, I don't know where to post this (since FFTW developers do not provide help with VB, and posting on MSDN for non-VB related question is kinda dumb) so I decided to ask you guys. :) I really can't import FFTW library in VB.NET 9 (VS 2008). When trying to reference to it i get this error message: A reference to '...\libfftw3-3.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component. My guess is that file is not "a valid assembly or COM component". How to fix this. Thanks for any help. Sincerely, Filip.
FFTW and VB.NET
Started by ●March 11, 2010
Reply by ●March 11, 20102010-03-11
vilaemail wrote:> Hi, > > I don't know where to post this (since FFTW developers do not provide help > with VB, and posting on MSDN for non-VB related question is kinda dumb) so > I decided to ask you guys. :) > > I really can't import FFTW library in VB.NET 9 (VS 2008). When trying to > reference to it i get this error message: > > A reference to '...\libfftw3-3.dll' could not be added. Please make sure > that the file is accessible, and that it is a valid assembly or COM > component. > > My guess is that file is not "a valid assembly or COM component". How to > fix this. Thanks for any help.Do you really need FFTW ? Would simple straightforward FFT work for you? #include <math.h> #if !defined M_PI #define M_PI 3.14159265359 #endif void fft(float *x,float *y,int order,int param) { unsigned int n,l,e,f,i,j,o,o1,j1,i1,k; float u,v,z,c,s,p,q,r,t,w,a; n=1u<<order; for(l=1;l<=order;l++) { u=1.0; v=0.0; e=1u<<(order-l+1); f=e/2; z=M_PI/f; c=cos(z); s=sin(z); if(param==FFT) s=-s; for(j=1;j<=f;j++) { for(i=j;i<=n;i+=e) { o=i+f-1; o1=i-1; p=x[o1]+x[o]; r=x[o1]-x[o]; q=y[o1]+y[o]; t=y[o1]-y[o]; x[o]=r*u-t*v; y[o]=t*u+r*v; x[o1]=p; y[o1]=q; } w=u*c-v*s; v=v*c+u*s; u=w; } } j=1; for(i=1;i<n;i++) { if(i<j) { j1=j-1; i1=i-1; p=x[j1]; q=y[j1]; x[j1]=x[i1]; y[j1]=y[i1]; x[i1]=p; y[i1]=q; } k=n/2; while(k<j) { j=j-k; k=k/2; } j+=k; } if(param==FFT) return; a=1.0/n; for(k=0;k<n;k++) { x[k]*=a; y[k]*=a; } return; }
Reply by ●March 11, 20102010-03-11
Reply by ●March 11, 20102010-03-11
vilaemail wrote:>I don't know where to post this (since FFTW developers do not providehelp>with VB, and posting on MSDN for non-VB related question is kinda dumb)No surprise there. I doubt they'd help with MSVC even, and C's at least a sane language.>I really can't import FFTW library in VB.NET 9 (VS 2008). When trying to >reference to it i get this error message: > >A reference to '...\libfftw3-3.dll' could not be added. Please make sure >that the file is accessible, and that it is a valid assembly or COM >component. > >My guess is that file is not "a valid assembly or COM component". How to >fix this. Thanks for any help.Well, both. The three dots in the path probably doesn't help. I seem to recall that being a shortcut in '95 or something, but... Probably no easy fix. That's not even a supported language, nevermind the compiler/OS. Search for (or write) a wrapper (bindings) of some sort. My guess is people who care enough to use FFTW couldn't be bothered with something like .NET, though there's all types of people...
Reply by ●March 12, 20102010-03-12
> >Well, both. The three dots in the path probably doesn't help. I seem to >recall that being a shortcut in '95 or something, but... > >Probably no easy fix. That's not even a supported language, nevermindthe>compiler/OS. Search for (or write) a wrapper (bindings) of some sort.My>guess is people who care enough to use FFTW couldn't be bothered with >something like .NET, though there's all types of people... > >The dots were placed by me. In message box I get good absolute path. Well then do suggest me any other language (in witch I could make all FFT functions and create a .dll or .exe that will later be callable by vb.net).
Reply by ●March 12, 20102010-03-12
vilaemail wrote:> >> >>Well, both. The three dots in the path probably doesn't help. I seemto>>recall that being a shortcut in '95 or something, but... >> >>Probably no easy fix. That's not even a supported language, nevermind >the >>compiler/OS. Search for (or write) a wrapper (bindings) of some sort. >My >>guess is people who care enough to use FFTW couldn't be bothered with >>something like .NET, though there's all types of people... >> >> > >The dots were placed by me. In message box I get good absolute path.Ok, if it works for you.>Well then do suggest me any other language (in witch I could make all FFT >functions and create a .dll or .exe that will later be callable byvb.net). Search the web for how to call native (unmanaged) C code from your language of choice. I have no idea how to write a .NET assembly (nor would I want to), and I've never had to write a COM component, though I'd consider doing so if need be. You have 2 requirements: 1) write your wrapper in a language/environment that can call FFTW (such as MSVC, though don't try to compile FFTW itself in there) 2) expose one of the two interfaces that VB.NET wants. I'm not sure if COM can even do it, but *if* it can, MFC or ATL might simplify some aspects. Please do some searching before writing back. Again, this whole mess seems to be a very roundabout way of doing things, and you may be better off in this situation understanding AND translating Vlad's code instead of using FFTW, assuming a power of two is ok with you.