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++ / May 2005

Tip: Looking for answers? Try searching our database.

c2491 error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mschmitz - 05 May 2005 19:31 GMT
Im trying to update some code from VC 6.0 to .net 03.

While building i get the c2491 error (definition of dllimport function
not allowed), which i have seen posted on here but havent found a
solution to.

Does this mean i can only delcare a dllimport function and NEVER define
it? What is the solution, or where can i find a link to a previously
post.  
Thanks,
mschmitz


Antti Keskinen - 06 May 2005 11:47 GMT
Hello !

Yes, it means precisely that. Imported functions can only have a declaration
such as follows:

__declspec(dllimport) int ImportedFunc(int nParam1, int nParam2);

This will create an entry into the module's import table, and tries to find
an exported ImportedFunc from any and all other modules this one is linked
with. If it is not found, you will receive a linker error "Unresolved
symbol". You cannot define an imported function. That's the way it is
supposed to work, and there's no changing it.

However, the immediate question that rises to my mind is why on earth would
you want to define an imported function ?
Also, it's impossible to provide a solution to you, because you've not
stated a problem either. Being unable to define an imported function is not
a problem; it's a feature of the language, the way it's supposed to work.

-Antti Keskinen

> Im trying to update some code from VC 6.0 to .net 03.
>
[quoted text clipped - 13 lines]
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------

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.