[fpc-pascal] Re: Problems with "relocation errors"

2010-11-06 Thread leledumbo

AFAIK PE DLLs are always relocatable while it's not true for ELF SOs. So,
whenever you need to create it, always pass -fPIC to ALL used units and
their dependencies.
-- 
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Problems-with-relocation-errors-tp3252196p3252857.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: variables in class, class variables and fields

2010-11-06 Thread leledumbo

> I think both are basically identical, but the work of the first one is 
> much more clear. I had never used them, but I think the above code is 
> right, do not ?

Yes. Usually we need this when creating a thread pool, so we know how many
threads have been created.
-- 
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/variables-in-class-class-variables-and-fields-tp3252382p3252858.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: variables in class, class variables and fields

2010-11-06 Thread ik
But why class variables and not class fields ?

Ido

LINESIP websites:
http://www.linesip.com
http://www.linesip.co.il




On Sat, Nov 6, 2010 at 09:26, leledumbo  wrote:

>
> > I think both are basically identical, but the work of the first one is
> > much more clear. I had never used them, but I think the above code is
> > right, do not ?
>
> Yes. Usually we need this when creating a thread pool, so we know how many
> threads have been created.
> --
> View this message in context:
> http://free-pascal-general.1045716.n5.nabble.com/variables-in-class-class-variables-and-fields-tp3252382p3252858.html
> Sent from the Free Pascal - General mailing list archive at Nabble.com.
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Problems with "relocation errors"

2010-11-06 Thread Sven Barth

On 06.11.2010 08:25, leledumbo wrote:


AFAIK PE DLLs are always relocatable while it's not true for ELF SOs. So,
whenever you need to create it, always pass -fPIC to ALL used units and
their dependencies.


PE images themselves aren't relocatable. All addresses are relative to 
the defined base address. The loader must manually recalculate the 
addresses if the binary can't be loaded at the base address.


See also here: http://en.wikipedia.org/wiki/Portable_Executable#Relocations

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: variables in class, class variables and fields

2010-11-06 Thread Sven Barth

On 06.11.2010 15:39, ik wrote:

But why class variables and not class fields ?


As I personally think about normal class fields as "variables per class 
instance", I see no difference between calling something "class field" 
or "class variable".


If it is the "var" keyword you are stumbling on, then let me tell you 
that normal fields can also be started with "var" (which is needed when 
you defined class types or constants before that).


E.g. (compiled with 2.5.1):

  TTest = class
  private
const
  Foo = 42;
var
  fTestField: Integer;
  public
property TestField: Integer read fTestField;
  end;

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: variables in class, class variables and fields

2010-11-06 Thread Paul Ishenin

06.11.2010 21:39, ik wrote:

But why class variables and not class fields ?

What is the difference?

"var" is already a reserved word. reserving a word "field" will cause 
more problems than using an already reserved word.


Best regards,
Paul Ishenin.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: variables in class, class variables and fields

2010-11-06 Thread ik
On Sat, Nov 6, 2010 at 17:13, Paul Ishenin  wrote:

> 06.11.2010 21:39, ik wrote:
>
>> But why class variables and not class fields ?
>>
> What is the difference?
>
> "var" is already a reserved word. reserving a word "field" will cause more
> problems than using an already reserved word.
>


why not something like this:

TAClass = class
private
  FField : class integer;
end;

Further more, what is the difference between a "normal" field and a variable
inside a class:

TAClass = class
private
  var Variable : Integer;
end;

That's what I'm trying to figure out.

Ido


>
> Best regards,
> Paul Ishenin.
>
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: variables in class, class variables and fields

2010-11-06 Thread Paul Ishenin

06.11.2010 22:16, ik wrote:

why not something like this:

TAClass = class
private
  FField : class integer;
end;
"var" and "class var" starts new sections in the class declaration. 
Therefore you can define several class fields or instance fields after them.


For example
TAClass = class
private
  class var
Field1: Integer;
Field2: String;
  var
Field3: Integer;
Field4: String;
end;

Further more, what is the difference between a "normal" field and a 
variable inside a class:


TAClass = class
private
  var Variable : Integer;
end;


var - you start a fields section
Variable : Integer;  - you declare a field inside this section.

You can skip "var" in this case. But if you previosly had "const" or 
"type" section or had a method/property declaration and want to declare 
a field again then you need to explicitly start a field section by "var" 
keyword.


For example:

TAClass = class
private
  type
 TMyInt = type integer;
  var // this keyword is required here
Field1: TMyInt;
end;

Best regards,
Paul Ishenin.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Problems with "relocation errors"

2010-11-06 Thread dibo20

W dniu 06.11.2010 08:25, leledumbo pisze:

AFAIK PE DLLs are always relocatable while it's not true for ELF SOs. So,
whenever you need to create it, always pass -fPIC to ALL used units and
their dependencies.

So where else can I put this switch to fix lNet compiler errors?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Is it posible to get a minimal installation of Lazarus?

2010-11-06 Thread yu ping
I want to set up Lazarus as FPC Editor and Debuger.
But Lazarus installation is too big,How to install a minimal size of
Lazarus?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Problems with "relocation errors"

2010-11-06 Thread Marco van de Voort
In our previous episode, Sven Barth said:
> >
> > AFAIK PE DLLs are always relocatable while it's not true for ELF SOs. So,
> > whenever you need to create it, always pass -fPIC to ALL used units and
> > their dependencies.
> 
> PE images themselves aren't relocatable. All addresses are relative to 
> the defined base address. The loader must manually recalculate the 
> addresses if the binary can't be loaded at the base address.
> 
> See also here: http://en.wikipedia.org/wiki/Portable_Executable#Relocations

They _are_ relocatable (it contains structures to relocate), but _not_
position independant (you must relocate if load address changes)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Working Free Pascal android JNI example

2010-11-06 Thread Felipe Monteiro de Carvalho
Hello,

Did you try making executables for Android? It is possible to run
native executables from Java.

That would be somewhat better then running the code from a .so

Also a tutorial about how to create the cross-compiler and set
everything up would be excelent ...

>From your zip file it seams that you based your work on Windows, correct?

thanks,
-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Re: Problems with "relocation errors"

2010-11-06 Thread Sven Barth

On 06.11.2010 18:11, Marco van de Voort wrote:

In our previous episode, Sven Barth said:


AFAIK PE DLLs are always relocatable while it's not true for ELF SOs. So,
whenever you need to create it, always pass -fPIC to ALL used units and
their dependencies.


PE images themselves aren't relocatable. All addresses are relative to
the defined base address. The loader must manually recalculate the
addresses if the binary can't be loaded at the base address.

See also here: http://en.wikipedia.org/wiki/Portable_Executable#Relocations


They _are_ relocatable (it contains structures to relocate), but _not_
position independant (you must relocate if load address changes)


I threw two things into one pot... I'm sorry :)

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Working Free Pascal android JNI example

2010-11-06 Thread Reimar Grabowski
On Sat, 6 Nov 2010 18:39:53 +0100
Felipe Monteiro de Carvalho  wrote:

> Did you try making executables for Android? It is possible to run
> native executables from Java.
It is not my code but I know a bit about Android.
I don't know of any way running native executables from Java on this platform. 
It is definitly not officially supported.
You can run native FPC progs on Android devices via the development tools 
circumventing the official way to install software. You can start this progs 
from your pc but not from the device itself. Since you cannot distribute this 
kind of software via official channels (market and the like) it is not of much 
use. Also I don't really know how to interact with these kinds of programs or 
how to run a GUI.
 
> That would be somewhat better then running the code from a .so
True, but as it is not supported there is no better way than to run your code 
from a lib. At least it is native then and you get the performance improvements.
To my knowledge it is currently the best way to use FPC on Android. You must 
remember that Android apps are not really complete programs (as you know them) 
but some special Java classes that are run from an 'app manager'. You don't 
have the kind of control you know from conventional programs.

hih
R.
-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Working Free Pascal android JNI example

2010-11-06 Thread Felipe Monteiro de Carvalho
On Sat, Nov 6, 2010 at 8:46 PM, Reimar Grabowski  wrote:
> I don't know of any way running native executables from Java on this 
> platform. It is definitly not officially supported.

Here is a tutorial:

http://gimite.net/en/index.php?Run%20native%20executable%20in%20Android%20App

It just uses standard Android Java API calls AFAIK

> Since you cannot distribute this kind of software via official channels 
> (market and the like) it is not of much use.

Google does not impose this kind of limit on market applications. As
long as you have the standard installer packages and has a stub Java
program calling our Pascal app it should be fine.

> Also I don't really know how to interact with these kinds of programs

The most workable that I found is through pipes between the Java and
the FPC app.

Sockets are also a possibility, but I think (not sure) they will
probably add more overhead then pipes.

> or how to run a GUI.

This is the tricky part. The obvious answer is OpenGL ES.

I would like to use the Surface Manager C API instead, but I haven't
found any documentation about it so OpenGL ES seams to be the workable
solution.

-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Is it posible to get a minimal installation of Lazarus?

2010-11-06 Thread Graeme Geldenhuys
On 6 November 2010 18:29, yu ping  wrote:
> I want to set up Lazarus as FPC Editor and Debuger.
> But Lazarus installation is too big,How to install a minimal size of
> Lazarus?

In that case, simply use MSEide instead. It's much smaller and faster.
It's a 1.8MB (Windows) or 2.0MB (Linux) download for the IDE binary,
and maybe 20K for some sample project templates (though not required).
The source (2.4 release) download is 2.9MB. MSEide has much better GDB
debugger support too.

  http://sourceforge.net/projects/mseide-msegui/


-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net:8080/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Working Free Pascal android JNI example

2010-11-06 Thread Graeme Geldenhuys
On 6 November 2010 19:39, Felipe Monteiro de Carvalho wrote:
>
> Did you try making executables for Android? It is possible to run
> native executables from Java.

I'm very interested in this too. My next toy is going to be a Android
based tablet (mostly for ebook reading), but I would like to develop
for it too.

Any info would be much appreciated.


-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net:8080/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: linker error when cross compile for arm

2010-11-06 Thread Michael Fung
After much googling, still can't find any clue.

Synapse claims it supports cross platform.

I check the difference between hello world and tcpclient1 program.

hello world:
8000:Searching file /usr/lib/fpc/2.5.1/units/arm-linux/rtl/prt0.o...
found

tcpclient1:
8000:Searching file
/usr/lib/fpc/2.5.1/units/arm-linux/rtl/cprt0.o... found

Does that mean tcpclient1 relies on Libc? And this dependency is not
good for cross compile?


Rgds,
Michael


On 2010/11/6 上午 11:18, Michael Fung wrote:
> Dear all,
> 
> 
> I followed the wiki at:
> http://wiki.lazarus.freepascal.org/Setup_Cross_Compile_For_ARM
> 
> After that, I can compile a hello world program  for arm without
> problem, great!
> 
> But when I try to compile a program with the synapse units it gives the
> following error:
> 
> /usr/lib/fpc/2.5.1/units/arm-linux/rtl/cprt0.o: In function
> `_haltproc_eabi':
> (.text+0x88): undefined reference to `_fini'
> /usr/lib/fpc/2.5.1/units/arm-linux/rtl/cprt0.o: In function
> `_haltproc_eabi':
> (.text+0x90): undefined reference to `_init'
> tcpclient1.lpr(42,21) Error: Error while linking
> tcpclient1.lpr(42,21) Fatal: There were 1 errors compiling module, stopping
> 
> 
> Any ideas please?
> 
> Rgds,
> Michael
> 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal