Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Baffling unresolved token error

20 views
Skip to first unread message

Brian Victor

unread,
May 24, 2005, 10:37:44 AM5/24/05
to
I'm trying to get FFTW (fftw.org) to work in such a way that it can be
called from a managed C++ module. The approach I've found to generate
the fewest linker errors is a mixed managed/unmanaged project.
However, that still produces the following from the linker:

FFTW2 error LNK2020: unresolved token (0A0000C6) fftw_execute

Running ildasm on the resulting dll shows:

.method public static unmanagedexp void
modopt([mscorlib]System.Runtime.CompilerServices.CallConvCdecl)
fftw_execute(valuetype fftw_plan_s*
modopt([Microsoft.VisualC]Microsoft.VisualC.IsConstModifier) p) cil
managed

Other calls to FFTW with similar disassemblies link without complaint.
Commenting my call to fftw_execute causes the program to link. What
might be causing the link failure in this case?

Any ideas would be helpful. I've been working on this for a week and
am totally stumped. Thanks!

--
Brian

Brian Victor

unread,
May 24, 2005, 4:17:55 PM5/24/05
to
Replying to myself with more info, I tried once again to compile FFTW
as an non-CLR .lib rather than a CLR .dll. This causes it to link but
fail at runtime with the following:

An unhandled exception of type 'System.TypeLoadException' occurred in
mymodule.dll

Additional information: Could not load type fftw_plan_s from assembly
MyModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.

fftw_plan_s is an internal structure in FFTW. It is not exposed as
part of the public interface, except as a pointer typedef to fftw_plan
which I am using. Do I need to do something to expose this struct to
the unmanaged CLR C++ code?

--
Brian

Ronald Laeremans [MSFT]

unread,
Jun 3, 2005, 8:45:30 PM6/3/05
to

What version of the compiler are you using? If it is the 2003 / 7.1
version you need to add an empty definition for fftw_plan_s. If you are
using the 2005 / 8.0 version the linker will add that for you (and
generate a warning telling you it did).

The CLR needs to have a definition of a type available even to create a
pointer to it.

Ronald Laeremans
Visual C++ team

Brian Victor

unread,
Jun 9, 2005, 11:16:23 AM6/9/05
to
Ronald Laeremans [MSFT] wrote:

> Brian Victor wrote:
> > Additional information: Could not load type fftw_plan_s from assembly
> > MyModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
> >
> > fftw_plan_s is an internal structure in FFTW. It is not exposed as
> > part of the public interface, except as a pointer typedef to fftw_plan
> > which I am using. Do I need to do something to expose this struct to
> > the unmanaged CLR C++ code?
> What version of the compiler are you using? If it is the 2003 / 7.1
> version you need to add an empty definition for fftw_plan_s. If you are
> using the 2005 / 8.0 version the linker will add that for you (and
> generate a warning telling you it did).

Thanks for replying, Ronald. I am using 2003/7.1. I've become pretty
comfortable in my workaround at this point, but if I come across the
problem again I'll give that a shot.

--
Brian

0 new messages