473,383 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

How to get standard C and C++ working together? How to debug a DLL?

Hi,

(sorry if this post might occur two times, but I can't find my first
one from yesterday evening in this group)

I have a bigger VC++6.0 project which is successfully compiled into a
DLL. I had to combine this code with my one which worked fine for
itself. After integrating my code one into one of the classes the the
compiler threw errors. They disappeared after the compiler option
__STDC__ was removed. Apparently the larger project was build in full
conformance with the ANSI C standard. My code is C++ code (and can't
be rewritten), thus the errors when compiled with __STDC__ activated.
An additional __ANSI_CPP__ is defined in the DLL project as well, but
doesn't seem to harm or benefit to the build process of the combined
project.

The problem now is, that my DLL does compile without erros but doesn't
work when used by an EXE. It simply crashes. As a DLL has no console
output, how can I get some indication what goes wrong? How can I debug
a DLL with VC++? And most importantly: How can I integrate ANSI C and
VC++ in one project? Is there such a thing as guidelines, general
rules or special compiler settings?

Cheers
Chris
Jul 19 '05 #1
2 3164
ak
On 11 Aug 2003 15:13:18 -0700, ch************@hitlabnz.org (Christian Graf)
wrote:

|The problem now is, that my DLL does compile without erros but doesn't
|work when used by an EXE. It simply crashes. As a DLL has no console
|output, how can I get some indication what goes wrong? How can I debug
|a DLL with VC++? And most importantly: How can I integrate ANSI C and
|VC++ in one project? Is there such a thing as guidelines, general
|rules or special compiler settings?

Since you are the author of the DLL it should be no problem to debug it,
just specify the .EXE as startup for your DLL in the debug options.
Alternatively you could build in trace output by using TRACE() / ATLTRACE() /
OutputDebugString in your DLL and use DBGViEW from www.sysinternals.com
to check the debug output.

your exported functions in the DLL must bear non-mangled names by specifying
them being extern "C" if they are to be used by a C program, there are also some
rules what you can export to a C-program - check your online help.

anyway try posting in microsoft.public.vc.language or any other suitable
microsoft.public NGs for better help.

hth
Anders

--
ak @ workmail.com
A wise man washes his hands after he pees. A wiser man doesn't pee on his hands.
Jul 19 '05 #2

"Christian Graf" <ch************@hitlabnz.org> wrote in message
news:6f**************************@posting.google.c om...
Hi,

<snip>

In most cases, if you simply just include the C code, and compile the entire
thing as if it were C++, you should have no problems. Just make sure to
include the right include files for the appropriate C functions.

Jul 19 '05 #3

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

Similar topics

4
by: Thomas Pfaff | last post by:
Hello all, I started using the nice Pythonwin IDE together with Python 2.3 (I have come to prefer its editor to IDLE). My problem is, that when I want to run a script in the debugger, I can...
20
by: skoco | last post by:
Hello! Do you know when will be the new standard for c++ approved? And WHAT will be inside? Hope there will be some thread and synchro classes, text and XML parsing, new containers and other new...
43
by: Steven T. Hatton | last post by:
Now that I have a better grasp of the scope and capabilities of the C++ Standard Library, I understand that products such as Qt actually provide much of the same functionality through their own...
5
by: Ross A. Finlayson | last post by:
Hi, I'm scratching together an Access database. The development box is Office 95, the deployment box Office 2003. So anyways I am griping about forms and global variables. Say for example...
5
by: Liam | last post by:
Hi We are thinking of purchasing some algorithms from another company. These are written in VB.NET. We need to run these algorithms on a embedded microcontroller. What am thinking is convert the...
0
by: bvh | last post by:
When I try to run an asp.net project I get a message stating: Error while trying to run project: Unable to start debugging on the web server. The project is not configured to be debugged. ...
6
by: Bryan Dickerson | last post by:
I have a string that is delimited, e.g. "SOD;NAME;ADDRESS1;ADDRESS2;PHONE;CITY;STATE;ZIP;EOD", that I need to strip off the "SOD;" at the beginning and the ";EOD" at the end. I am well familiar...
56
by: Chris Hills | last post by:
Hi, It came up in a standards panel meeting the other day that "all c or C++ programmers" have a copy of ISO C and/or C++ ... I challenged this and said most don't (outside those working on...
83
by: achintmehta | last post by:
I am working on MontaVista Linux on a PPC board. The compiler I am using is a gnu cross compiler cross compiler (ppc-82xx-gcc) The application/software that is being run, is messing up the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.