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++ / September 2007

Tip: Looking for answers? Try searching our database.

Win32 API functions?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dragonslayer008@hotmail.com - 17 Sep 2007 17:54 GMT
I moved some unmanaged C++ code into a C++/CLI project.  The unmanaged
code makes some Win32 API calls.  I thought as long as I kept the API
calls in a native class, it would integrate seamlessly.  However, I am
getting a whole bunch of linker errors with regards to the API calls:

Example:

error LNK2028: unresolved token (0A00001A) "extern "C" int __stdcall
MessageBoxA(struct HWND__ *,char const *,char const *,unsigned int)" (?
MessageBoxA@@$$J216YGHPAUHWND__@@PBD1I@Z) referenced in function
"public: void __clrcall D3DException::showMsg(void)" (?
showMsg@D3DException@@$$FQAMXXZ)
SvenC - 17 Sep 2007 18:14 GMT
Hi Dragonslayer (real names are welcome, btw),

> I moved some unmanaged C++ code into a C++/CLI project.  The unmanaged
> code makes some Win32 API calls.  I thought as long as I kept the API
[quoted text clipped - 8 lines]
> "public: void __clrcall D3DException::showMsg(void)" (?
> showMsg@D3DException@@$$FQAMXXZ)

You still need to tell the linker which libs to bind. MessageBox comes from
user32.dll. So check your linker settings in your project properties. Don't
forget to add the libs for debug and release (or all the configs you use).

--
SvenC
dragonslayer008@hotmail.com - 17 Sep 2007 18:39 GMT
> Hi Dragonslayer (real names are welcome, btw),
>
[quoted text clipped - 14 lines]
> user32.dll. So check your linker settings in your project properties. Don't
> forget to add the libs for debug and release (or all the configs you use).

Thanks.  I forgot managed applications don't link that by default.

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.