login about faq

Chilkat Purebasic module can't work in x86 (32bits) Linux OS, it works only for x86_64.

When I try to run it on 32-bit Linux, I get an Access Violation.

asked Oct 03 at 10:51

chilkat's gravatar image

chilkat ♦♦
11.8k316358421


I tested on 32-bit Linux and found the same problem. However, the access violation is caused by the OpenLibrary call failing to find the libchilkatPb32-9_5_0.so.

Each Chilkat PureBasic module (such as CkCrypt2.pb), contains the following snippet of code to load the shared library:

...
  CompilerSelect #PB_Compiler_OS
    CompilerCase #PB_OS_Windows
      CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
        CkCrypt2LibId.i = OpenLibrary(#PB_Any, "chilkatPb32-9_5_0.dll")
      CompilerElse
        CkCrypt2LibId.i = OpenLibrary(#PB_Any, "chilkatPb-9_5_0.dll")
      CompilerEndIf
    CompilerCase #PB_OS_MacOS
        CkCrypt2LibId.i = OpenLibrary(#PB_Any, "libchilkatPb-9_5_0.dylib")
    CompilerCase #PB_OS_Linux
      CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
        CkCrypt2LibId.i = OpenLibrary(#PB_Any, "libchilkatPb32-9_5_0.so")
      CompilerElse
        CkCrypt2LibId.i = OpenLibrary(#PB_Any, "libchilkatPb-9_5_0.so")
      CompilerEndIf
  CompilerEndSelect
...

If a full directory path to the .so is provided, then PureBasic will find the shared library. For example:

...
  CompilerSelect #PB_Compiler_OS
    CompilerCase #PB_OS_Windows
      CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
        CkCrypt2LibId.i = OpenLibrary(#PB_Any, "chilkatPb32-9_5_0.dll")
      CompilerElse
        CkCrypt2LibId.i = OpenLibrary(#PB_Any, "chilkatPb-9_5_0.dll")
      CompilerEndIf
    CompilerCase #PB_OS_MacOS
        CkCrypt2LibId.i = OpenLibrary(#PB_Any, "libchilkatPb-9_5_0.dylib")
    CompilerCase #PB_OS_Linux
      CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
        CkCrypt2LibId.i = OpenLibrary(#PB_Any, "/home/someUser/chilkat/libchilkatPb32-9_5_0.so")
      CompilerElse
        CkCrypt2LibId.i = OpenLibrary(#PB_Any, "/home/someUser/chilkat/libchilkatPb-9_5_0.so")
      CompilerEndIf
  CompilerEndSelect
...

If the .so filepath passed to OpenLibrary does not include a path, then the operating system will search for the library in its system folders, the applications directory and the current directory. If it is not found, then OpenLibrary returns 0.

The solution is to make sure the .so is located in a directory where the operating system will find it, or to specify the full path to the .so in the .pb module.

link

answered Oct 03 at 11:27

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Also, code that creates a new Chilkat object can check the return value to see if it was successful. If not, then it most likely means the library (.so) could not be found.

    crypt.i = CkCrypt2::ckCreate()
    If crypt.i = 0
        Debug "Failed to create object."
        ProcedureReturn
    EndIf

link

answered Oct 03 at 11:34

chilkat's gravatar image

chilkat ♦♦
11.8k316358421

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×17
×5
×3
×3

Asked: Oct 03 at 10:51

Seen: 165 times

Last updated: Oct 03 at 11:34

powered by OSQA