473,507 Members | 8,022 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

I used the same approach as the one described here:
http://blogs.msdn.com/jonathanswift/...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

Jul 19 '07 #1
1 1708

"greg" <gr************@gmail.comwrote in message
news:11**********************@x35g2000prf.googlegr oups.com...
>I used the same approach as the one described here:
http://blogs.msdn.com/jonathanswift/...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'"?
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

Jul 19 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3595
by: me | last post by:
I have a Class Library that contains a Form and several helper classes. A thread gets created that performs processing of data behind the scenes and the Form never gets displayed (it is for debug...
7
8822
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
2
1167
by: Sammut | last post by:
Hi, I am trying to create a class in which I create a number of functions that I can call from differenet places in my program. I create a new class called ecs Then I create a function in it...
4
3163
by: MechSoft | last post by:
Hi, there, I have a multi-threaded non-MFC program that will include a regular dll which would be part of the user interface, possibly a dialog based interface. I would prefer to have the user...
2
3174
by: Bill Nguyen | last post by:
How can I create a shared function to display process progress that can be called from other routines within an application? Any example that I can follow? Thanks Bill
1
15540
by: Rocio | last post by:
I have a windows app. written in VB6, now we need to expose some of its classes through a web service. I am only able to expose the classes using late binding becasue that's the way the original...
5
4858
by: Michael | last post by:
Hello, I've created an ASP web page where users in our organization can create Active Directory computer accounts. The web page is running on a Server 2003 SP1 IIS 6 installation. The...
2
6554
by: Angel Of Death | last post by:
I have a method. It takes some XML as a parameter. Depending on the content of the XML it should create a specific object and call a KNOWN method. So: public void PersistXml(string XmlData){} ...
7
6194
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function Body_Onload() ' create the object Set obj = Server.CreateObject("UploadImage.cTest") ' use method of the object...
4
12413
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
0
7105
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7371
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7023
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5037
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
410
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.