0
votes

I build an application in Borland C++ 6 and I'd like to import external, non Borland library (FFTW, to be exact, http://www.fftw.org).

I have downloaded the fftw dll file, used the implib.exe program to build a lib file known to Borland, included fftw.h in source and copied fftw.h to Borland/include, fftw.lib to Borland/lib and .h, .dll and .lib files to my project folder.

Unfortunately I get several linker errors, which claims:

Unresolved external '{name of the FFTW function}' referenced from {name of the source file}

What do I do wrong?

3

3 Answers

2
votes

I'm just telling from a similar story how I managed to get it to work...

There was a DLL that worked (was being sucessfully imported) with Delphi 7, VB.NET and Java. I wanted to make a program with Borland C++ Builder 6 with it. I had the function prototypes and the exact declarations that made the import on those languages. Reasonable?

I thought it would be easy, but I stucked on many dead ends without sucess, with step by step "blind" guides that didn't worked for me. And the IDE or command outputs not helping either.

After a few days I tried (from question 4599357, although the DLL isn't in Visual C++):

  1. using "implib" without "-a" and
  2. having the prototypes declared like this:

extern "C" __declspec(dllimport) __stdcall int someDll_someFunction(someTypes someArgs, ...);

Note that the normal function prototype is at the end. If you have the "normal" prototypes, just add "extern "C" __declspec(dllimport) __stdcall" before them to your source code or header file. :) And I only have functions that return "int", this is why I put "int" there.

1
votes

I think you're only missing one step... add the .lib file that implib created to your project.

0
votes

Are you sure that Borland is doing proper name-mangling of the external functions, and that the header has been surrounded with extern "c" {}? And are you sure that Borland is indeed trying to link with the .lib file? Make sure the compiler has the verbose option set.

If that doesn't work, why don't you build FFTW from source instead of using a DLL?