This is a migrated thread and some comments may be shown as answers.

Problems using the interop 'C' style interface for Win32 monitor DLL

3 Answers 56 Views
Monitor integration
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steve
Top achievements
Rank 1
Steve asked on 08 Jan 2014, 11:19 AM
Hi, 

I am converting the Eqatec.Analytics.Monitor.Interop.h header file into Delphi and am having a few issues with the exports from the supplied "EQATEC.Analytics.Monitor.Win32_dll10.dll" library (version 3.2.1.0).

It appears that the following exports all map to the same entry point 0x10006900h in the DLL :


_Eqatec_AnalyticsMonitorCapabilities_MaxAllowedBandwidthUsagePerDayInKB@4
_Eqatec_AnalyticsMonitorStatus_IsStarted@4]
_Eqatec_IAnalyticsMonitor_Stop@4
_Eqatec_StorageDataDescriptor_DataType@4


I have seen this both via the debugger by stepping into the DLL and looking at the DLL export table via PE Explorer.

Can anyone help explain why I am seeing this?

Many thanks

Steve













3 Answers, 1 is accepted

Sort by
0
Richard Flamsholt
Telerik team
answered on 09 Jan 2014, 03:55 PM
Hi Steve,

First of all, I have no explanation for the duplicate RVA values. Our tests of the exported plain C methods does not seem to be affected by this and going back in history I can see that there's been duplicate  entries for the entire lifetime of the monitor. I'm not even sure it really presents a problem, though it admittedly does seem strange - maybe something else is wrong?

Unfortunately, we don't provide any Delphi-bindings ourselves but we do have some customers that use Delphi so presumably it's not impossible.

Some questions and suggestions:

1) What concrete errors do you experience?

2) Have you tried using/importing the lib instead? If I recall correctly, e.g. Embarcadero can import lib-files. Using the LIB intermediary is the conventional way of calling into exported DLL methods when developing in C or C++. I'm not sure how the lib does the mapping - maybe it uses ordinals instead.


Regards,
Richard Flamsholt
Telerik
ICENIUM MONITOR AVAILABLE FOR DOWNLOAD.
Monitor and track applications built with Icenium at run-time. Reduce support by fixing run-time crashes as they occur, obtain user insights such as location and system configuration, find and remove application bottlenecks, and track which features are used most to help prioritize development.
Try Icenium with EQATEC Analytics today >>
0
Steve
Top achievements
Rank 1
answered on 09 Jan 2014, 06:35 PM
Hi Richard,

Thanks for your reply. This is not a Delphi issue, I am directly using the Windows API (LoadLibrary / GetProcAddress) to access the entry points to the exports. 

>  1) What concrete errors do you experience?

When I call the entry point in the DLL for Eqatec_IAnalyticsMonitor_Stop it jumps to the SAME point in the DLL as when I call Eqatec_AnalyticsMonitorStatus_IsStarted (i.e the same code, it can't be both").

I have tried Static Binding, Dynamic Binding and loading by Ordinal, which all, as you have noticed yourself, resolve to the same overlapping entry point.

I do not understand how using the interface via the .lib is working unless it ignores what the export entry point table in the DLL says and keeps it's own references. We cannot import that lib as we are using Delphi 5 here.

Maybe you could do a quick set of tests that use the DLL directly with the above functions using the LoadLibrary / GetProcAddress to verify these findings. I would be great if we could find a solution to this.

Kind regards

Steve


0
Richard Flamsholt
Telerik team
answered on 10 Jan 2014, 10:03 AM
Hi Steve,

I looked into this and it turns out not to be a bug, but a compiler optimization.

The 4 functions in question are indeed served by the same entry point. It just so happens that the code generated for each of them is completely similar: each of the four dereferences a member (at the same offset) and invokes a method (also at the same offset for all four, and with similar signatures), like e.g. the IsStarted() method shown here:

bool __stdcall Eqatec_AnalyticsMonitorStatus_IsStarted(const Eqatec_AnalyticsMonitorStatus *status) { return status->Target->IsStarted(); }

So, GetProcAddress returning the same address is actually correct. Interesting :-)

Regards,
Richard Flamsholt
Telerik
ICENIUM MONITOR AVAILABLE FOR DOWNLOAD.
Monitor and track applications built with Icenium at run-time. Reduce support by fixing run-time crashes as they occur, obtain user insights such as location and system configuration, find and remove application bottlenecks, and track which features are used most to help prioritize development.
Try Icenium with EQATEC Analytics today >>
Tags
Monitor integration
Asked by
Steve
Top achievements
Rank 1
Answers by
Richard Flamsholt
Telerik team
Steve
Top achievements
Rank 1
Share this question
or