Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > General Discussion
  New Posts New Posts RSS Feed - 32 bit Debenu DLL loding on 64 bit machine
  FAQ FAQ  Forum Search   Register Register  Login Login

32 bit Debenu DLL loding on 64 bit machine

 Post Reply Post Reply
Author
Message
kumarp11 View Drop Down
Beginner
Beginner


Joined: 09 Oct 18
Location: United States
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote kumarp11 Quote  Post ReplyReply Direct Link To This Post Topic: 32 bit Debenu DLL loding on 64 bit machine
    Posted: 25 Oct 18 at 11:29PM
Hello,
I am using the below code to load the proper DLL in my application but I am sometimes noticing that 32 bit Debenu DLL loading on 64 bit widows operating system. Why it is happening and does it cause any issue while printing?


PDFLibrary quickPdf = null;
                        if (IntPtr.Size == 8)
                        {
                            quickPdf = new PDFLibrary(DllPath64Bit);
                        }
                        else
                        {
                            quickPdf = new PDFLibrary(DllPath32Bit);
                        }
                    quickPdf.UnlockKey(key);
Back to Top
Wheeley View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 Oct 05
Location: United States
Status: Offline
Points: 146
Post Options Post Options   Thanks (0) Thanks(0)   Quote Wheeley Quote  Post ReplyReply Direct Link To This Post Posted: 26 Oct 18 at 12:55AM
Just because your OS is 64-bit doesn't mean you should use a 64-bit dll. You should only use a 64-bit DLL if you program is compiled as a 64-bit application, otherwise tehe 32-bit should be used. So how are you compiling your code? 32-bit or 64-bit?
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 26 Oct 18 at 7:37PM
Some more common words regarding 32-/64-bit...
If you're using a 64 bit dll then you can use it only in 64 bit environments. On 64 bit systems the dll should be in the system32-directory: On 64 bit systems this directory (irritating name!) is used only for 64 bit dlls. If you're using a 32 bit dll it should be in the SysWOW64-directory on 64-bit-environments.
If you're working with a 64 bit development and a 64 bit dll you may need to set your compiler platform target to "Any CPU” to create a 64 bit EXE instead of "x86" to force it to create a 32 bit EXE. Application and dll should have the same architecture – both 32- or both 64 bit.
Cheers,
Ingo

Back to Top
kumarp11 View Drop Down
Beginner
Beginner


Joined: 09 Oct 18
Location: United States
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote kumarp11 Quote  Post ReplyReply Direct Link To This Post Posted: 26 Oct 18 at 9:49PM
Actually, we have customers using a mix of environments, 32 bit machines and 64 bit machines(WIN 10,8 and Win 7). We want Debenu 32 bit dll to load on 32 bit machines(OS) and 64 bit dll to load on 64 bit machines(OS). We are using this code to determine which DLL to load but sometimes we are seeing 32 bit dll getting loaded on 64 bit machines. I did some investigation and found that if IntPtr.Size is 8 then it indicates 64 bit environment and using this code accordingly to load debenu dll.

 PDFLibrary quickPdf = null;
                        if (IntPtr.Size == 8)
                        {
                            quickPdf = new PDFLibrary(DllPath64Bit);
                        }
                        else
                        {
                            quickPdf = new PDFLibrary(DllPath32Bit);
                        }
                    quickPdf.UnlockKey(key);

are we doing something wrong?
Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 27 Oct 18 at 10:22AM
Probably.  IntPtr.Size will depend on whether the program calling the DLL is built as a 32-bit or 64-bit program, which is a compiler setting.  If you build your application to run as a 32-bit process, the pointer size will not change if you run this program on a 64-bit operating system, the pointer size it uses will not change and it will still require a 32-bit DLL.

The key rule to remember is that a 32-bit DLL cannot be called by a 64-bit process, and vice-versa.

You can test whether the environment running your 32-bit process is 64-bit by various means (Google will help you).  I load kernel32.dll without a path and see if it contains an entrypoint named GetSystemWow64Directory, but there are plenty of other means. The answer will not change the pointer size used by the compiler, or which DLL your program needs to load.
Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (0) Thanks(0)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 27 Oct 18 at 10:28AM
I should add: if you are seeing a 32-bit DLL successfully loaded on a 64-bit OS, this tells you that the 64-bit OS is running a 32-bit version of your application.  And if you see a 64-bit DLL successfully loaded, a 64-bit version of your application.  In the first case, your user has simply managed to choose the 32-bit version somehow, if you deliver both.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 28 Oct 18 at 1:47PM
Hi,

"...We are using this code to determine which DLL to load...".

If this code is running on your single app this will never work.
A 64 bit app needs a 64 bit dll and a 32 bit app needs a 32 bit dll.
The app and the functions inside a dll needs the same bit-architecture for proper working.

Cheers,
Ingo

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store