[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

Delphi 5 legacy application - now needs to call C++ DLL with mangled names

Asked by dlwynne in Delphi Programming

Tags: Delphi 5

We have an old Delphi 5 legacy application that calls some 3rd party DLLs written in Microsoft C. We don't have the source to the DLLs.

The calls are declared like this in the Pascal code:

function EnableSomething: ResultCode; cdecl; external something.dll';

and everything compiles and works fine.

We now have some updated DLLs to work with newer hardware (the old stuff is now obsolete). The new version of the DLL has the same name, but a TDump of the DLL shows that all functions now have leading underbars (_EnableSomething) and have mangled C++ names (_EnableSomething@0).  I can easily change the external references and function calls in the Delphi 5 source to include the leading underbars, but (of course) calls to the functions fail at runtime due to the mangled names.

I found a fix, using the index ordinal. So the external reference now reads:

function EnableSomething: ResultCode; cdecl; external something.dll' index 25;

So I can go through every call and affix the proper index (and hope I don't typo any) and get this to work.,

My question is:  Is there a better, easier or more automated way to do this?

I don't want to port this to newer Delphi and want to make as few changes to the Delphi source as possible - it is a tried and true app and just needs to call the new DLL.

In Borland C Builder programs that use these same DLLs I was able to use IMPLIB to work around this, but could come up with no simple and "automated" way to make this work in Delphi. Maybe nothing exists?  I thought of writing a C Builder wrapper to call from Delphi that would translate the names, but it would be easier and faster just to use the index ordinal.

If looks like the functions are exported in alphabetical order, if they add a new _aardvark() function call I would have to change EVERY index to use the newer DLLs :-( .

Thanks!



 
Related Solutions
Keywords: Delphi 5 legacy application - now nee…
 
Loading Advertisement...
 
[+][-]07/08/08 01:00 PM, ID: 21957627Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/08/08 02:06 PM, ID: 21958254Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/08/08 07:35 PM, ID: 21960193Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07/09/08 12:25 AM, ID: 21961249Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07/23/08 03:47 PM, ID: 22074638Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Delphi Programming
Tags: Delphi 5
Sign Up Now!
Solution Provided By: dlwynne
Participating Experts: 3
Solution Grade: A
 
 
Loading Advertisement...
20091111-EE-VQP-89 / EE_QW_2_20070628