Solved

Can't use a C++ (v7.1) and MFC DLL in Delphi 6.....

Posted on 2004-09-28
7
214 Views
Last Modified: 2006-11-17
I'm using Delphi 6 (Pascal) to load a C++/MFC DLL. In Delphi, after I load the library, I can see the entry points in the library. One of the functions in the library is TrackData. The entry point should be TrackData but it looks like this instead:

?TrackData@@YAHPAD@Z

I have never had a problem using a library in Delphi before. This DLL was written by another person in a sister company and I think that they need to do something to better expose the functions within their library but I'm not a C++ programmer so I wouldn't know what to tell them. It may not be a problem with their library or my loading of it. It may just be an incompatibility problem.

What I need is some kind of direction as to what they are not doing that needs to be done. Code examples or anything would be helpful. I know this isn't much to go on but ask me anything and I'll get back to you as soon as I can. If you have a question for the C++ programmer, give it to me and I'll relay it to them.

Extra Info: All parameters within the DLL functions are compatible with Delphi.

Thanks for any help given.


0
Comment
Question by:blueyellowgreen
  • 4
  • 3
7 Comments
 
LVL 14

Accepted Solution

by:
wayside earned 500 total points
ID: 12169051
The function name has been mangled by the C++ compiler to indicate what type its arguments are. This mangling is usually incompatable from one compiler to the next.

You need to get the other c++ programmer to declare his functions using the

extern "C"

construct. This will remove the mangling, and you will be able to easily use it.

0
 

Author Comment

by:blueyellowgreen
ID: 12169206
Thanks for the quick reply. I've sent your comment to the c++ programmer. Fingers crossed! :)
0
 
LVL 14

Expert Comment

by:wayside
ID: 12169331
I think they could also fix this by adding the relevant functions to the library's .def file:

EXPORTS
  TrackData=?TrackData@@YAHPAD@Z

This might be easier than changing the code to use extern "C".
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

Author Comment

by:blueyellowgreen
ID: 12169466
I've sent her that comment also. :)
0
 

Author Comment

by:blueyellowgreen
ID: 12182970
Hi,

The C++ programmer is still working on the DLL changes. As soon as the suggestions given above have been tried, I will be back to accept one of the suggestions or ask for more suggestions.

Thanks for you patience.  :)

0
 

Author Comment

by:blueyellowgreen
ID: 12216812
Wayside, The extern "C" worked like a charm! Thanks very much!!! :)
0
 
LVL 14

Expert Comment

by:wayside
ID: 12217187
Glad I could help! :)
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question