AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen FreePascal [GNU/Linux, FPC] Linkerproblem bei SO's
Thema durchsuchen
Ansicht
Themen-Optionen

[GNU/Linux, FPC] Linkerproblem bei SO's

Ein Thema von implementation · begonnen am 11. Feb 2011 · letzter Beitrag vom 13. Feb 2011
Antwort Antwort
Benutzerbild von implementation
implementation

Registriert seit: 5. Mai 2008
940 Beiträge
 
FreePascal / Lazarus
 
#1

[GNU/Linux, FPC] Linkerproblem bei SO's

  Alt 11. Feb 2011, 09:56
Guten Morgen,

ich habe meine Testbibliothek aus diesem Thread etwas erweitert mit einer Variable:
Delphi-Quellcode:
{$mode objfpc}{$longstrings on}

unit CrayLib;

interface

uses CrayInter;

type
   TPowerstaff = class(TInterfacedObject, IPowerstaff)
   public
      procedure Writeln(s: pchar);
   end;
   
procedure Hello;
procedure Bye;
function RequestStaff: IPowerstaff;

implementation

var
   FAppRunning: Boolean;

procedure TPowerstaff.Writeln(s: pchar);
begin
   System.WriteLn(String(s));
end;

procedure Hello;
begin
   if FAppRunning then WriteLn('Error: Application is already running!');
   FAppRunning := true;
end;

procedure Bye;
begin
   if not FAppRunning then WriteLn('Error: Application isn''t running!');
   FAppRunning := false;
end;

function RequestStaff: IPowerstaff;
begin
   Result := TPowerstaff.Create;
end;

initialization
   FAppRunning := false;
end.

// --------------------------------------

library Cray;

uses CrayLib, CrayInter;

procedure println(s: pchar); deprecated;
begin
   WriteLn(String(s));
end;

exports println, bye name 'cfbye', hello name 'cfhello', RequestStaff name 'reqpow';

end.
Leider wird daraus nichts:
Code:
/usr/bin/ld: CrayLib.o: relocation R_X86_64_32S against `U_CRAYLIB_FAPPRUNNING' can not be used when making a shared object; recompile with -fPIC
Wenn ich alle Zeilen auskommentiere, in denen die Variable benutzt wird, gibt es keine Probleme.

Was kann ich machen?
  Mit Zitat antworten Zitat
Benutzerbild von BUG
BUG

Registriert seit: 4. Dez 2003
Ort: Cottbus
2.094 Beiträge
 
#2

AW: [GNU/Linux, FPC] Linkerproblem bei SO's

  Alt 11. Feb 2011, 10:52
recompile with -fPIC

Ohne zu wissen, was dann passiert: Hast du das mal probiert?

PS: Habe was dazu gefunden.
Intellekt ist das Verstehen von Wissen. Verstehen ist der wahre Pfad zu Einsicht. Einsicht ist der Schlüssel zu allem.
  Mit Zitat antworten Zitat
Benutzerbild von implementation
implementation

Registriert seit: 5. Mai 2008
940 Beiträge
 
FreePascal / Lazarus
 
#3

AW: [GNU/Linux, FPC] Linkerproblem bei SO's

  Alt 11. Feb 2011, 10:54
Das Flag ist aber für gcc, beim FPC bringt das nichts.
  Mit Zitat antworten Zitat
creed steiger

Registriert seit: 2. Dez 2009
116 Beiträge
 
#4

AW: [GNU/Linux, FPC] Linkerproblem bei SO's

  Alt 11. Feb 2011, 14:19
hilft das weiter?
http://bugs.freepascal.org/view.php?id=12940
http://lists.freepascal.org/lists/fp...er/027228.html

ansonsten würd ich an deiner Stelle mal in der FPC Mailinglist fragen
  Mit Zitat antworten Zitat
Benutzerbild von Assarbad
Assarbad

Registriert seit: 8. Okt 2010
Ort: Frankfurt am Main
1.234 Beiträge
 
#5

AW: [GNU/Linux, FPC] Linkerproblem bei SO's

  Alt 11. Feb 2011, 14:27
PIC == Position Independent Code

Im Windows-Jargon heißt das "relozierbar". Ob es nun in FPC eine Option dazu gibt, weiß ich nicht.
Oliver
"... aber vertrauen Sie uns, die Physik stimmt." (Prof. Harald Lesch)
  Mit Zitat antworten Zitat
Benutzerbild von JamesTKirk
JamesTKirk

Registriert seit: 9. Sep 2004
Ort: München
604 Beiträge
 
FreePascal / Lazarus
 
#6

AW: [GNU/Linux, FPC] Linkerproblem bei SO's

  Alt 12. Feb 2011, 13:59
Das Flag ist aber für gcc, beim FPC bringt das nichts.
*hust*

Code:
[sven@artemis ~]$ fpc -h | grep -i pic
      -Cg       Generate PIC code
  -fPIC Same as -Cg
Und ja, der Schalter funktioniert.

Gruß,
Sven
Sven
[Free Pascal Compiler Entwickler]
this post is printed on 100% recycled electrons
  Mit Zitat antworten Zitat
Benutzerbild von implementation
implementation

Registriert seit: 5. Mai 2008
940 Beiträge
 
FreePascal / Lazarus
 
#7

AW: [GNU/Linux, FPC] Linkerproblem bei SO's

  Alt 13. Feb 2011, 14:24
Es läuft!

Vielen Dank
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:09 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz