View Issue Details

IDProjectCategoryView StatusLast Update
0028545FPCCompilerpublic2015-09-02 14:48
ReporterPatrickS Assigned ToJonas Maebe  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionduplicate 
PlatformarmhfOSLinux (Wheezy) 
Product Version3.1.1 
Summary0028545: Loading self-build shared lib in lazarus failed
DescriptionIt is not possible to load a self created library (created with lazarus 2.6.4/ and svn-Version) in a lazarus programm. BUT it is possible to load other created shared libs. Inder Linux (x64) and Windows (x64) it is possible.
Steps To ReproduceCompile the following lib under armhf with compiler 3.1.1 under linux ant try to load it in the programm beneth the lib:

Code for the shared lib:

library project1_dll;

{$mode objfpc}{$H+}

uses
  Classes
  { you can add units after this };

  function Patrick_Add(a,b:integer):integer;cdecl;export;
  begin
      Patrick_Add:=a+b;
  end;

exports Patrick_Add;

begin
end.


CODE for the programm:
program project1;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes,dynlibs
  { you can add units after this };

type TPatrick_Add=function(a,b:integer):integer;

var mylib:TLibHandle = dynlibs.NilHandle;
    MyFunc: TPatrick_Add;
    result:integer;

begin
     Writeln('Hello');
     mylib:=LoadLibrary('C:\Users\USERNAME\Desktop\Proba\project1_dll.'+sharedsuffix);
     if mylib = dynlibs.NilHandle then Writeln('Problem found')
                                  else begin
                                    Writeln('OK');
                                    MyFunc:=TPatrick_Add(dynlibs.GetProcedureAddress(mylib,'Patrick_Add'));
                                    if MyFunc<>nil then Writeln('Func Found');
                                    //Writeln(MyFunc(1,1));
                                  end;

     Writeln(GetLoadErrorStr);
     Readln;
end.

Additional InformationTried to load the lib under fpc-2.6.4 (armhf) and 3.1.1(armhf)
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Relationships

duplicate of 0026454 resolvedFlorian FPC program can't load a FPC shared library on armhf-linux (RPi) 

Activities

PatrickS

2015-08-19 14:19

reporter   ~0085439

The Path was changed under unix in /Path_to_lib/lib.so

PatrickS

2015-08-20 09:08

reporter   ~0085457

http://free-pascal-general.1045716.n5.nabble.com/shared-library-on-arm-linux-raspberry-pi-td5719653.html

Here is also a link to a forum ticket which also handles with this topic.

Anton Kavalenka

2015-08-20 16:51

reporter   ~0085462

maybe 0026454

PatrickS

2015-08-29 15:33

reporter   ~0085581

Hey, I tried this thing, but it fails. There is always and end which says do not known "cycle" no rule to build.

Issue History

Date Modified Username Field Change
2015-08-19 14:18 PatrickS New Issue
2015-08-19 14:19 PatrickS Note Added: 0085439
2015-08-20 09:08 PatrickS Note Added: 0085457
2015-08-20 16:51 Anton Kavalenka Note Added: 0085462
2015-08-29 15:33 PatrickS Note Added: 0085581
2015-09-02 14:48 Jonas Maebe Relationship added duplicate of 0026454
2015-09-02 14:48 Jonas Maebe Status new => resolved
2015-09-02 14:48 Jonas Maebe Resolution open => duplicate
2015-09-02 14:48 Jonas Maebe Assigned To => Jonas Maebe