Print Page | Close Window

DLL won't load

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1700
Printed Date: 06 May 25 at 12:01PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: DLL won't load
Posted By: RAG
Subject: DLL won't load
Date Posted: 05 Jan 11 at 11:48PM
We update client programs remotely by storing the *.exe in a database blob record on a central server. When updates are available, they are loaded from the server to the client and written to the local PC.

With Windows 7, that means that we can't use \program files\* since it would take elevated permissions, etc.

So, we install and update the programs for the client in \user\app data\roaming\subdir\*

That works fine... except... the DLL version (also placed in the roaming directory), will not load in our report programs.

We use a declare to create the library:
soft declare function QuickPDFCreateLibrary lib pdflib () as integer

The programming platform is RealSoftware, so the syntax of the declare may be a bit different that VB6, etc. The pdflib is a string constant with the name of the dll "QuickPDFDLL0722.dll"

I can get it to load if I place the DLL in "\Program Files\subdir\QuickPDFDLL0722.dll" and reference the pdflib constant to that address, but it just won't load if it is in the roaming directory.

The programs on the client all run from the roaming directory.

Help!

RAG
------------



Replies:
Posted By: AndrewC
Date Posted: 09 Jan 11 at 1:35AM
What is the exact error message when the program runs on the client PC and it cannot find / load the DLL.

I also assume you are trying this in a debugger.  What is the return value of the LoadLibrary call.  Maybe that will give you more information.

An EXE file should also search for DLL's in the current directory.  ie .  The same directory as the EXE file itself.  This sounds like what you want to happen but it is not working.

Have your tried posting a support call to RealSoftware.  It you can get the DLL to load in a different location then it is unlikely to be related to QuickPDF but more to RealSoftware.  Do you use other DLL's in the same way with RealSoftware.  If not you many want to quickly load a different DLL to see if it has the same problem.


Posted By: Ingo
Date Posted: 09 Jan 11 at 3:41PM
Hi RAG!

Normally applications using dlls are looking first in system32
or sysWow64 and after this they are looking in the own app-directory.
If there are different dlls on the system (in system32 and app-path for example)
this can be a problem?

Cheers and welcome here,
Ingo





Posted By: Dimitry
Date Posted: 12 Jan 11 at 2:33AM
System path variable %USERPROFILE% value should be used for proper access to
..\Application Data (..\AppData\Roaming). 
The %USERPROFILE% path is usually used to store application data including executable files and libraries which actually can be executed/loaded.
The problem may appear with %USERPROFILE% folders access rights.
 
Here is Delphi code snippet that may help you. It was tested with Windows XP and Windows 7.
If it doesn't work you should check user and folders access rights matching.
 
uses
  QuickPDFDLL0723;
 
const
  USER_PROFILE = 'USERPROFILE';
  APPLICATION_DATA = '\Application Data';
  WORK_DIR = '\subdir';
  LIBRARY_NAME = '\QuickPDFDLL0723.dll';

var
  libpath: string;
  qpl: TQuickPDFDLL0723;

begin
  libpath := GetEnvironmentVariable(USER_PROFILE) +
    APPLICATION_DATA + WORK_DIR + LIBRARY_NAME;
  // Check is QuickPDF*.dll exists at libpath
  if not FileExists(libpath) then
    Exit;
  qpl := TQuickPDFDLL0723.Create(libpath);
  try
    with qpl do
    begin
      UnlockKey('type your license key here');
      SetOrigin(1);
      DrawText(100, 100, 'Hello DLL!');
      SaveToFile('sample.pdf');
    end;
  finally
    qpl.Free;
  end;
end;
 
 


-------------
Regards,
Dmitry



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk