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# / July 2007

Tip: Looking for answers? Try searching our database.

Create a C/C++ dll and call it from C#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
greg - 19 Jul 2007 18:46 GMT
I used the same approach as the one described here:
http://blogs.msdn.com/jonathanswift/archive/2006/10/02/780637.aspx

The only catch is that the project which I am trying to compile into a
dll is half written in C and the other half in C++. What were the
developers thinking !?! I am using Visual Studio 2005 and to create
the dll, I ran New Project -> Win32 Project -> Application Settings ->
DLL (plus the additional option of exporting symbols). Then I declare
all the functions in the MyDll.h and also include the header file of
the original project in stdafx.h. After including the latter header in
the *.c and *.cpp files the following error was thrown:

"fatal error C1853: 'Debug\MyDll.pch' precompiled header file is from
a previous version of the compiler, or the precompiled header is C++
and you are using it from C (or vice versa)"

If I don't include stdafx.h in the *c and *cpp files the following
error is thrown:

"fatal error C1010: unexpected end of file while looking for
precompiled header. Did tou forget to add '#include "stdafx.h" to your
source'"?

Can anyone help me out? I would really appreciate your input?

Thanks,
Greg
Ben Voigt [C++ MVP] - 19 Jul 2007 19:26 GMT
>I used the same approach as the one described here:
> http://blogs.msdn.com/jonathanswift/archive/2006/10/02/780637.aspx
[quoted text clipped - 18 lines]
> precompiled header. Did tou forget to add '#include "stdafx.h" to your
> source'"?

Under Configuration Properties -> C/C++ -> Precompiled Headers you can
disable them.  I would recommend doing so for at least the .c files.

> Can anyone help me out? I would really appreciate your input?
>
> Thanks,
> Greg

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.