Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2005

Tip: Looking for answers? Try searching our database.

Baffling unresolved token error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brian Victor - 24 May 2005 15:37 GMT
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!

Signature

Brian

Brian Victor - 24 May 2005 21:16 GMT
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?

Signature

Brian

Ronald Laeremans [MSFT] - 04 Jun 2005 01:45 GMT
> 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
[quoted text clipped - 10 lines]
> 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).

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 - 09 Jun 2005 16:16 GMT
> > Additional information: Could not load type fftw_plan_s from assembly
> > MyModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null.
[quoted text clipped - 7 lines]
> 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.

Signature

Brian


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.