PDF-Tools DLLs base address optimization suggestion

This Forum is for the use of Clarion For Windows - Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics.

Moderators: Tracker Support, TrackerSupp-Daniel, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Tracker - Clarion Support, John - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software, Support Staff, moderators

Post Reply
tieto_hc
User
Posts: 3
Joined: Thu Jan 08, 2009 7:28 am

PDF-Tools DLLs base address optimization suggestion

Post by tieto_hc » Mon Oct 05, 2009 11:26 am

Hi!

I noticed that all PDF-Tools 4 DLLs have a default Visual C preferred load address of 0x10000000. Since many other DLLs also use this base address, loading a application which uses PDF-Tools dlls causes these dlls to be relocated to another address. Included is a Process Explorer screenshot which highlights the relocated dlls of a example application.

DLL relocation has two drawbacks:

1. Due to the relocation process, the application startup is slower than it could be.
2. In multi-user environments such as Terminal Services, the relocated dll cannot be shared by other sessions. This increases the memory requirements of an application, since every instance of a application has to have separate copies of the PDF-Tools dlls.

The second point in particular is a real issue to us in Terminal Server / Citrix environments, where our application has several dozens of simultaneous users in any given application server, and any memory optimization would be more than welcome.

It is quite easy to specify the base address in the C compiler and because this increases the performance of the PDF-Tools in general without any risks, it would be a really good addition to a further release.

Available and good memory ranges in general would be 0x12000000 to 0x1FFFFFFF or 0x30000000 to 0x5FFFFFFF, since these ranges aren't used by many other applications.

Another good way to do this is to use the editbin tool included in the MS Platform SDK. For example, rebasing dscrt40.dll and xccdx40.dll to a staring address of 0x40000000 would be done

Code: Select all

EDITBIN /REBASE:0x40000000 dscrt40.dll xccdx40.dll 
Of course, this would have to happen before the code signing of the dlls.

For more information on the DLL rebase process, please see

http://msdn.microsoft.com/en-us/library/ms810432.aspx
http://www.ddj.com/windows/184416272;js ... stid=20593

Best regards,
--
Timo Multanen
Attachments
pdf_tools_relocated_dlls.zip
Process Explorer showing the relocated dlls
(164.75 KiB) Downloaded 171 times

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13376
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: PDF-Tools DLLs base address optimization suggestion

Post by Tracker Supp-Stefan » Mon Oct 05, 2009 3:12 pm

Thanks Timo,

We take all suggestions in consideration here so I will pass yours to our development team but as you say any way to save memory and reduce load times is a plus for everybody :)

Regards,
Stefan

Ivan - Tracker Software
Site Admin
Posts: 3591
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: PDF-Tools DLLs base address optimization suggestion

Post by Ivan - Tracker Software » Tue Oct 06, 2009 6:17 pm

The Load address is dependant on the enviroment and the application which loads.

So, if you need to have an optimized system - by all means - rebase our dlls for your system.

HTH
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.

Tracker - Clarion Support
Site Admin
Posts: 1412
Joined: Wed Jun 30, 2004 4:45 pm
Location: Maryland, USA
Contact:

Re: PDF-Tools DLLs base address optimization suggestion

Post by Tracker - Clarion Support » Tue Oct 06, 2009 7:33 pm

Hi Timo!

For the Clarion environment especially, your suggestion is a good one!

As Ivan points out, our DLLs are written generically to support a wide range of development environments, and what might be a good rebase for one might cause trouble in another. So we'll continue to release our libraries using the default Visual C preferred load address of 0x10000000.

However there is nothing to prevent you, or any other developer, from rebasing as desired. I suggest maintaining archive copies of our DLLs that you can copy and rebase as desired.
Craig Ransom
Tracker Software - Clarion Support
http://www.tracker-software.com

tieto_hc
User
Posts: 3
Joined: Thu Jan 08, 2009 7:28 am

Re: PDF-Tools DLLs base address optimization suggestion

Post by tieto_hc » Wed Oct 07, 2009 12:12 pm

Hi Craig and Ivan,

And thanks for your replies!

I'm aware that I can manually rebase even 3rd party dlls, and I'd gladly do this, but this breaks your digital signatures on the dlls. Since it is a requirement to have signed executables on Vista / Windows 2008 / Windows 7 to eventually fulfill the requirements of the various Windows Logo programs, we'd then have to code sign those with our own Authenticode certificate. That would then imply that we are the original supplier of the PDF-Tools executables, which is not exactly the case.

Using default load address of 0x10000000 for all PDF-Tools / PDF-XChange dlls is the worst case scenario, since there's most likely another Visual C dll already loaded in the system occupying this default address. Therefore this always causes the relocation procedure to be done on application load and for every PDF-Tools dll used.

Having a less used base address as a starting point for the first PDF-Tools dll and configuring other PDF-Tools dlls to have sequentially a preferred load address (which doesn't overlap with the previous addresses, and which can be easily done with editbin tool) should always be a better approach. Even if all the load addresses would overlap with other dlls in use, this would be no worse than the current situation.

Note that it one thing to have a preferred address vs. having a fixed address - latter would cause the dll not to be loaded at all if couldn't load at its fixed address.

Best regards,
--
Timo Multanen

Ivan - Tracker Software
Site Admin
Posts: 3591
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: PDF-Tools DLLs base address optimization suggestion

Post by Ivan - Tracker Software » Wed Oct 07, 2009 3:08 pm

Ok. Will try to rebase our dlls to addresses starting from 0x12000000
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.

tieto_hc
User
Posts: 3
Joined: Thu Jan 08, 2009 7:28 am

Re: PDF-Tools DLLs base address optimization suggestion

Post by tieto_hc » Thu Oct 08, 2009 7:07 am

Thank you!

That is excellent news! I'm sure that this change will benefit all your customers.

BR,
--
Timo

User avatar
Tracker Supp-Stefan
Site Admin
Posts: 13376
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: PDF-Tools DLLs base address optimization suggestion

Post by Tracker Supp-Stefan » Thu Oct 08, 2009 12:39 pm

Our pleasure Timo :)

Best,
Stefan

Nardus
User
Posts: 1
Joined: Mon Jan 04, 2010 4:04 pm

Re: PDF-Tools DLLs base address optimization suggestion

Post by Nardus » Mon Sep 08, 2014 10:04 am

Hi

Seems like this never happened as the current base address is still 1000 0000h on the Clarion version of PDF tools in any case. (Still can't rebase a signed dll)

xccdx40.dll
xcpro40.dll
pxclib40.dll
fm40base.dll
fm40tiff.dll
ixclib40.dll
dscrt40.dll

Please see attached file for list of your dlls as well as CapeSoft's dlls in my app.

Thanks

Nardus
Attachments
Rebase.pdf
Rebase info
(10.16 KiB) Downloaded 104 times

Tracker - Clarion Support
Site Admin
Posts: 1412
Joined: Wed Jun 30, 2004 4:45 pm
Location: Maryland, USA
Contact:

Re: PDF-Tools DLLs base address optimization suggestion

Post by Tracker - Clarion Support » Mon Sep 08, 2014 3:42 pm

Hi Nardus!

I'm not sure which direction this went - I'll alert Ivan. :)
Craig Ransom
Tracker Software - Clarion Support
http://www.tracker-software.com

Post Reply

Return to “PDF-Tools SDK (DLL Libraries Only) - Clarion For Windows Developers Only Please”