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 / C++ Libraries / December 2003

Tip: Looking for answers? Try searching our database.

#including .h files from a .dll project, I can't get it to work!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
0to60 - 07 Nov 2003 20:44 GMT
I have a .dll project with both __gc and __nogc classes, managed and
unmanaged code.  In my unmanaged code, I want to call sqrt() from math.h.
So, I've #included <math.h> in the .cpp file, but I'm getting an unresolved
external symbol linker error.  I have the same code in an .exe project and
it works fine.  What the hell, Mel?
David Goon [MSFT] - 15 Dec 2003 17:51 GMT
Hi,

Given that you're facing a linker and not a compiler error, it should be
just choking on the name that the linker needs to resolve to an export from
a library. One possible problem could be the way the compiler is storing
the name for the linker. If you are compiling a .cpp file, it could be
possible that the compiler is decorating the function name (C++). Check by
looking at the linker error message and compare it with the output for the
function from the following:

dumpbin msvcrt.lib /exports (it should be _sqrt)

If you see something like ?sqrt@@YGE (I made this up) in the linker error,
then this is the problem.

To get around it, get the compiler to assume C style function names.

extern "C" {
#include <math.h>
}

Hope this provides some hints,
David Goon
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Rate this thread:







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.