Recent

Author Topic: Dynamic Libraries not loading, just returns 0  (Read 6483 times)

Nafees

  • Jr. Member
  • **
  • Posts: 55
Re: Dynamic Libraries not loading, just returns 0
« Reply #15 on: February 14, 2016, 11:24:50 am »
First of all the library doesn't even compile. If you want to use forms, frames, etc... you need to add LCL to the required packages and interfaces to the uses clauses. You also need to call application initialize, otherwise nothings gonna work. Secondly the library is loaded as you can see in the attachment, but you cannot call OnSave,  I already explained why in my previous post.
Where do I call Application.Initialize? Because I will be creating the same frame many times, do I call it just once or everytime?
« Last Edit: February 14, 2016, 11:27:46 am by Nafees »

GetMem

  • Hero Member
  • *****
  • Posts: 3508
Re: Dynamic Libraries not loading, just returns 0
« Reply #16 on: February 14, 2016, 11:34:12 am »
Quote
@Nafees
Where do I call Application.Initialize? Because I will be creating the same frame many times, do I call it just once or everytime?
Only once. This plugin like library topic was also covered here(Plugin.zip): http://forum.lazarus.freepascal.org/index.php/topic,30252.msg192411.html#msg192411  :D

Nafees

  • Jr. Member
  • **
  • Posts: 55
Re: Dynamic Libraries not loading, just returns 0
« Reply #17 on: February 14, 2016, 05:12:50 pm »
Quote
@Nafees
Where do I call Application.Initialize? Because I will be creating the same frame many times, do I call it just once or everytime?
Only once. This plugin like library topic was also covered here(Plugin.zip): http://forum.lazarus.freepascal.org/index.php/topic,30252.msg192411.html#msg192411  :D
I think it's a Ubuntu releated bug. That attachment also isn't loading the library, LibHandle is still nil after loading the library.

GetMem

  • Hero Member
  • *****
  • Posts: 3508
Re: Dynamic Libraries not loading, just returns 0
« Reply #18 on: February 14, 2016, 05:42:07 pm »
Quote
I think it's a Ubuntu releated bug. That attachment also isn't loading the library, LibHandle is still nil after loading the library.
Is loading fine at my side, I'm also using ubuntu 14.04 LTS.

Nafees

  • Jr. Member
  • **
  • Posts: 55
Re: Dynamic Libraries not loading, just returns 0
« Reply #19 on: February 15, 2016, 10:28:35 am »
Quote
I think it's a Ubuntu releated bug. That attachment also isn't loading the library, LibHandle is still nil after loading the library.
Is loading fine at my side, I'm also using ubuntu 14.04 LTS.
I also have the same version.

GetMem

  • Hero Member
  • *****
  • Posts: 3508
Re: Dynamic Libraries not loading, just returns 0
« Reply #20 on: February 15, 2016, 10:33:11 am »
@Nafees
Here is the proof:
https://youtu.be/f1iq0iSjIho

Nafees

  • Jr. Member
  • **
  • Posts: 55
Re: Dynamic Libraries not loading, just returns 0
« Reply #21 on: February 15, 2016, 11:38:33 am »
@Nafees
Here is the proof:
https://youtu.be/f1iq0iSjIho
I didn't meant to say that I doubt you. I think I know why it won't work with me: I'm new to lazarus and don't know how to add lcl to the packages. Do you just put lcl in uses or is it somewhere from the IDE?

EDIT: Solved the whole problem. The problem was that LCL package, just found out how to add it.

EDIT: I successfully loaded a dummy library, but that "plugin" library still won't load. Now, it gives this error on LoadLibrary:
Code: [Select]
Project QIDE raised exception class 'External: SIGSEGV'.

 In file './include/winapi.inc' at line 621
Any ideas why this is caused? I still remember it was fairly easy to do this on Delphi, but Delphi isn't on Linux.

EDIT: Fixed that too.
« Last Edit: February 16, 2016, 12:07:28 pm by Nafees »