troubleshooting Question

function parameters eliminated by linker

Avatar of TheMatrixDuck
TheMatrixDuck asked on
3 Comments1 Solution784 ViewsLast Modified:

I am receiving a "Symbol eliminated by Linker" error when my app calls into a dll. It just recently showed up in a mature codebase.

The dll contains a function that takes three parameters and returns a boolean and is declared in the cbuilder 4 code as:
    BOOL __stdcall __DLLTYPE__ AdjustVoucherDifference(HWND hOwner, char *receipt_id, bool commit);

The application's delphi declaration is in externs.pas as:
 function AdjustVoucherDifference(hOwner :HWnd; Receipt_ID :PChar; bCommit: Boolean): boolean; stdcall; external 'FBCoupon.dll' name 'AdjustVoucherDifference';

So, we're talking apples to apples and the delphi application calls the function as:
 AdjustVoucherDifference(Application.Handle, PChar(Receipt_ID), true);

Now the interesting part.  When debugging the application with a breakpoint on the function, you can see the values of the parameters being passed as (1002334, "RC000123001", True);

When you run to a second breakpoint on the declaration in externs.pas, the tooltip value says the linker has eliminated the symbol and blank/null values are passed to the dll.  The dll fails to execute properly and throws an exception (in this case an esqlerror exception) because the receiptID was unavailable in the sql where clause.

Any thoughts would sure be appreciated,
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros