[fpc-pascal] Pure FPC ?

2014-01-26 Thread fredvs
Hello.

Does it exist a option to compile fpc without Delphi compatibility ?

If no, what do you think about that ? 
I know, it will be lot of work (like create a Delhi_Compatiblizer class...)

PS : I absolutely do not want to hurt somebody, it is only a proposition.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Pure-FPC-tp5718124.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Error compile library on Linux.

2014-03-26 Thread fredvs
 You recompiled the FPC? Or simple change of fpc.cfg options solves your
problem?

Oops, sorry for the delay.

I only change  fpc.cfg options and it solves the problem...

Hum, im really sorry but i do not know what changes do the trick. (i did not
save the old fpc.cfg-not-working, so, i cannot compare).

Fred



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Error-compile-library-on-Linux-tp5718562p5718763.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Error compile library on Linux.

2014-03-26 Thread fredvs
@ Fabio Luis Girardi :

Here my working *fpc.cfg*
_
#
# Config file generated by fpcmkcfg on 5-3-14 - 21:58:27
# Example fpc.cfg for Free Pascal Compiler
#

# --
# Defines (preprocessor)
# --

#
# nested #IFNDEF, #IFDEF, #ENDIF, #ELSE, #DEFINE, #UNDEF are allowed
#
# -d is the same as #DEFINE
# -u is the same as #UNDEF
#

#
# Some examples (for switches see below, and the -? helppages)
#
# Try compiling with the -dRELEASE or -dDEBUG on the commandline
#

# For a release compile with optimizes and strip debuginfo
#IFDEF RELEASE
  -O2
  -Xs
  #WRITE Compiling Release Version
#ENDIF

# For a debug version compile with debuginfo and all codegeneration checks
on
#IFDEF DEBUG
  -gl
  -Crtoi
  #WRITE Compiling Debug Version
#ENDIF

# assembling
#ifdef darwin
# use pipes instead of temporary files for assembling
-ap
# path to Xcode 4.3+ utilities (no problem if it doesn't exist)
-FD/Applications/Xcode.app/Contents/Developer/usr/bin
#endif

# 
# Parsing switches
# 

# Pascal language mode
#  -Mfpc  free pascal dialect (default)
#  -Mobjfpc   switch some Delphi 2 extensions on
#  -Mdelphi   tries to be Delphi compatible
#  -Mtp   tries to be TP/BP 7.0 compatible
#  -Mgpc  tries to be gpc compatible
#  -Mmacpas   tries to be compatible to the macintosh pascal dialects
#
# Turn on Object Pascal extensions by default
#-Mobjfpc

# Assembler reader mode
#  -Rdefault  use default assembler
#  -Ratt  read ATT style assembler
#  -Rintelread Intel style assembler
#
# All assembler blocks are ATT styled by default
#-Ratt

# Semantic checking
#  -S2same as -Mobjfpc
#  -Scsupports operators like C (*=,+=,/= and -=)
#  -Sainclude assertion code.
#  -Sdsame as -Mdelphi
#  -Sex error options. x is a combination of the following:
# n : compiler stops after n errors (default is 1)
# w   : compiler stops also after warnings
# n   : compiler stops also after notes
# h   : compiler stops also after hints
#  -Sgallow LABEL and GOTO
#  -ShUse ansistrings
#  -Sisupport C++ styled INLINE
#  -Skload fpcylix unit
#  -SIx set interface style to x
# -SIcomCOM compatible interface (default)
# -SIcorba  CORBA compatible interface
#  -Smsupport macros like C (global)
#  -Sosame as -Mtp
#  -Spsame as -Mgpc
#  -Ssconstructor name must be init (destructor must be done)
#  -Sxenable exception keywords (default in Delphi/ObjFPC modes)
#
# Allow goto, inline, C-operators, C-vars
-Sgic

# ---
# Code generation
# ---

# Uncomment the next line if you always want static/dynamic units by default
# (can be overruled with -CD, -CS at the commandline)
#-CS
#-CD

# Set the default heapsize to 8Mb
#-Ch800

# Set default codegeneration checks (iocheck, overflow, range, stack)
#-Ci
#-Co
#-Cr
#-Ct

# Optimizer switches
# -Osgenerate smaller code
# -Oa=N  set alignment to N
# -O1level 1 optimizations (quick optimizations, debuggable)
# -O2level 2 optimizations (-O1 + optimizations which make debugging
more difficult)
# -O3level 3 optimizations (-O2 + optimizations which also may make
the program slower rather than faster)
# -Oox switch on optimalization x. See fpc -i for possible values
# -OoNOx   switch off optimalization x. See fpc -i for possible values
# -Opx set target cpu for optimizing, see fpc -i for possible values

#ifdef darwin
#ifdef cpui386
-Cppentiumm
-Oppentiumm
#endif
#endif

# ---
# Set Filenames and Paths
# ---

# Both slashes and backslashes are allowed in paths

# path to the messagefile, not necessary anymore but can be used to override
# the default language
#-Fr/usr/lib/fpc/$fpcversion/msg/errore.msg
#-Fr/usr/lib/fpc/$fpcversion/msg/errorn.msg
#-Fr/usr/lib/fpc/$fpcversion/msg/errores.msg
#-Fr/usr/lib/fpc/$fpcversion/msg/errord.msg
#-Fr/usr/lib/fpc/$fpcversion/msg/errorr.msg

# searchpath for units and other system dependent things
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/*
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/rtl

#IFDEF FPCAPACHE_1_3
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd13/
#ELSE
#IFDEF FPCAPACHE_2_0
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd20
#ELSE
-Fu/usr/lib/fpc/$fpcversion/units/$fpctarget/httpd22
#ENDIF
#ENDIF

# searchpath for fppkg user-specific packages
-Fu~/.fppkg/lib/fpc/$fpcversion/units/$FPCTARGET/*

# path to the gcclib
#ifdef cpui386
-Fl/usr/lib/gcc/x86_64-linux-gnu/4.8
#endif
#ifdef cpux86_64
-Fl/usr/lib/gcc/x86_64-linux-gnu/4.8
#endif

# searchpath for libraries
#-Fl/usr/lib/fpc/$fpcversion/lib
#-Fl/lib;/usr/lib

[fpc-pascal] Access fpc libraries with Java ?

2014-03-27 Thread fredvs
Hello.
I try to access fpc libraries with Java.
I can access those libraries with:
= Python without problems, even callback functions... 
= fpc programs, of course...

But with Java i get trouble...
I try with JNA :
 https://github.com/twall/jna
But without luck.

Does somebody already had access to fpc libraries with Java ?
So, is it possible ?
If yes, how do you do it ?

Many thanks.
Fred.




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Access-fpc-libraries-with-Java-tp5718791.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Access fpc libraries with Java ?

2014-03-27 Thread fredvs
Yep, yep, yep,   ... tetra * mega thanks.

Hum, i have very poor knowledge with Java. Of course i can do a Hello
World  and some other things.
But now, because of some fpc libraries, i explore the import native
library part of java.
And, what surprise me, in Java forum, was that lot of Java programmers want
to create their own library for use by other Java programmers, into Java
programs.

And for them there is only one solution : create a C library.
It exists tools to create the C header, but for creating their library, they
must know C.
And that is the problem, most of Java programmers are afraid about C (like
everybody ;-) ).

Java has a big % part of the programmers, so the question is :
= Why not propose to those poor Java developers who need to create a Java
compatible native library to do it... with fpc.

Other question:

= I know that it is a difficult for fpc to communicate with Java-Android.
Would it not be easier to interface via fpc libraries (who will do the hard
work) and let the final procedures done by Java ?

= Leledumbo and Hint = Re-thanks-thanks-thanks. ;-)

Fred



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Access-fpc-libraries-with-Java-tp5718791p5718795.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Access fpc libraries with Java ?

2014-03-27 Thread fredvs
Yep Leledumbo, this time you kill me.

Your code is working PERFECTLY and trust me, even at StackOverflow.com, they
do not know your trick, there are lot of questions for that without any
working answer.

Your GENIUS trick is to export name = Java_MyLib_MyProcedure.
I do not know if that could be done with C libraries but here i have a HUGE
argument to convert Java developers who need a native library to use fpc
instead of C.
And for us, fpc developers it is not difficult to adapt the code to be Java
full-easy compatible.

Leledumbo, i am your fan, forever.

Many thanks.

Fred

PS: Hum, why did you use 
= env,jcls: pointer;
 as arguments, is it needed for Java ?
I have try without and it works too...




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Access-fpc-libraries-with-Java-tp5718791p5718796.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Access fpc libraries with Java ?

2014-03-28 Thread fredvs
And then there are even specific tutorials if you look for JNI
 tutorial and maybe some language name and with the advent of Android
this got even more, because this is the way how you interface native
with Java code there... 

Hum, have you really test those tutorials ?
You must be a very good guru to understand JNI examples.

And if you see the example from Leledumbo it is 1.000 times more clear,
logical and easy.
Sorry, but i still think that it would be much easier for Java developers to
create-link fpc libraries than C libraries...

Fred.




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Access-fpc-libraries-with-Java-tp5718791p5718808.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Access fpc libraries with Java ?

2014-03-28 Thread fredvs
It's JNI requirement, I wonder it could work without as it may corrupt the
stack. 
The first parameter is the JVM environment, the second is the Java object 
 (or class in case of static method), the rest is actual parameters to the
 function. 

Yep, you are right, it was working only for function without argument (but i
use now your trick even for procedure without parameters.).

I have successfully adapt the libraries for Java and im really impressed by
the result (mainly for fpGUI and uos).

Hum, have you a idea how to deal with Pchar and Callback-Procedure ?
How to declare in java :

 Procedure MyProcPchar(MyPchar : Pchar) ;
and
 Type TProc : procedure;
 Procedure MyProcTproc(MyProc : TProc);

Many thanks.

 Procedure ProcProc(
  



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Access-fpc-libraries-with-Java-tp5718791p5718807.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Access fpc libraries with Java ?

2014-03-28 Thread fredvs
Welcome to real JNI programming :) 

Yep, i will study deeply JNI and the JNI Pascal wrapper. See you later. ;-)

Thanks.




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Access-fpc-libraries-with-Java-tp5718791p5718810.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Access fpc libraries with Java ?

2014-03-29 Thread fredvs
 Custom Drawn  Android Module Wizard has JNI wrapper, but they develop
each independently
 and I have no idea which one is better. Choose wisely. 

Yes, but sadly, both do not implement the JStringToString() function from
the original Delphi jni.pas.

OK, i will try to implement JStringToString() function (or find the
conversion-solution)...
PS : Advices are welcome...

Thanks.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Access-fpc-libraries-with-Java-tp5718791p5718814.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Some articles on Lazarus/Free Pascal.

2014-03-29 Thread fredvs
Whaw, super nice and lot of examples...
Many thanks. 



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Some-articles-on-Lazarus-Free-Pascal-tp5718816p5718817.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Access fpc libraries with Java ?

2014-03-29 Thread fredvs
 OK, i will try to implement JStringToString() function (or find the
conversion-solution)... 

Done =

function JStringtoString(PEnv: PJNIEnv; Obj: JObject; JavaStr: JString) :
String; 
var
 ifcop : pjboolean;
begin
result  := (PEnv^).GetStringUTFChars(PEnv, JavaStr, ifcop);
end;

He, he, he, ... now the last obstacle : Callback procedures... and Java is
in the pocket for fpc libraries...

PS = lot of things to add in fpc wiki ;-)

Fred



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Access-fpc-libraries-with-Java-tp5718791p5718821.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Access fpc libraries with Java ?

2014-03-31 Thread fredvs
 now the last obstacle : Callback procedures... 

Hum, i do not find why it is not working ;-(

I follow jni c examples but with no luck.

Does somebody knows how to deal with callback procedures and Java ?

Here Library Pascal code :

procedure formonclick(PEnv: PJNIEnv; Obj: JObject; aproc: JString); cdecl;
begin
JMethod :=
(PEnv^^).GetStaticMethodID(PEnv,(PEnv^^).GetObjectClass(PEnv,Obj),(PEnv^^).GetStringUTFChars(PEnv,
aproc, nil),'()V')  ; 
end;

And here Java code :

public class fpg {  

public native void register();
public void callback() {
writeln(Ýep it works);
}
 public static native void buttononclick(int i, int j, String t);
 
  public static void main(String[] args) {
System.loadLibrary(fpg);
 formonclick(callback);
}
} 

fpc Library and java app compiles but when running the java app i get that
error :

Exception in thread main java.lang.NoSuchMethodError:  callback1
 at fpg.formonclick(Native Method)  at fpg.main(fpg.java:34) 

What is wrong ? = I do not understand because callback is declared in main
java thread..

Any help would be extremely appreciated.

Many thanks.
   
Fred.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Access-fpc-libraries-with-Java-tp5718791p5718829.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/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Access fpc libraries with Java ?

2014-03-31 Thread fredvs
Yep, i get it ;-)

Explanations on Lazarus forum :
=
http://forum.lazarus.freepascal.org/index.php/topic,24063.msg144634.html#msg144634

No more obstacle now, Java is in the pocket.

Cheers.




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Access-fpc-libraries-with-Java-tp5718791p5718834.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] JNI/Android: Java events calling pascal code

2014-04-21 Thread fredvs
Hello.

take a look here :
= http://wiki.freepascal.org/Using_Pascal_Libraries_with_Java

At =  Dealing with callback procedures.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/JNI-Android-Java-events-calling-pascal-code-tp5718988p5718989.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] JNI/Android: Java events calling pascal code

2014-04-23 Thread fredvs
Hello.

Hum, if you are not obliged to use Java media-player, you may use 
= https://github.com/fredvs/uoslib.

That fpc audio library is Java-comatible and can do easy callbacks...



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/JNI-Android-Java-events-calling-pascal-code-tp5718988p5719002.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] java events calling pascal code vs java calling library.

2014-04-24 Thread fredvs
Hello.

Could it be possible to have some infos ans arguments about this :
Im newbie in Java-link-with-fpc and I would like to understand what
can/cannot be done.

Here what i understood (If im wrong, please, correct me...)

= All Java os (Android and friends) can only deal with Java class.

= If i want to use Pascal code, i need first to create a Java class and,
via Java events-methods it is possible to execute Pascal code. The Pascal
code is inside the Java class when compiling Java application.

= A other way to use Pascal code is via a Pascal library. You need to
compile the fpc library with some Java arguments, and so the fpc library
is perfectly Java-compatible. The disadvantage is that you need to give that
external Java native library with your application.

= If giving that external Java native library with your application is
not a problem,, using fpc library is much easier than using Pascal code via
Java events-methods.

Please, where im wrong, what else must i know... ?

Many thanks.

Fred



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/java-events-calling-pascal-code-vs-java-calling-library-tp5719036.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] java events calling pascal code vs java calling library.

2014-04-25 Thread fredvs
Many thanks Stephano.

 as my java exposure started only a few days ago.

Same for me. I have successfully adapt some of my fpc native libraries into
Java-native libraries.
Im extremely happy with the result, all the functions/procedures are
exported and working. Even callback procedures.

I am only blocked how to create a Java wrapper class for those libraries...
All Java , code-guru, stackoverflow forum cannot help me...

Without that library wrapper class, i have to declare all the native
methods of the library inside the main Java class.

But it works perfectly...



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/java-events-calling-pascal-code-vs-java-calling-library-tp5719036p5719050.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Create and use a wrapper class in java

2014-04-27 Thread fredvs
Hello wonderful fpc people.

Hum, i want to create a Java wrapper class to access some fpc Java native
libraries.
I have already asked it everywhere, looking in all Java doc, but... without
luck.

Here the unique answer i get (from codeguru.com)

=
http://forums.codeguru.com/showthread.php?544463-Create-and-use-a-wrapper-class-in-javap=2151435#post2151435

But that answer is not working (see my last post in codeguru.com).

How to do it or where to search help (and get a working example) ?

Many thanks.

Fred



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Create-and-use-a-wrapper-class-in-java-tp5719072.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Create and use a wrapper class in java

2014-04-27 Thread fredvs
Hello Stephano.

 Did you put each class in a separate file? 

Yes, of course, it is the goal :
= a separate wrapper class (TheWrapper.java), with all the methods defined
to use the library,
= and the main class (test.java) who uses that wrapper class.

So, the same wrapper class way be used by other main class...

But impossible to find how to do that... ;-( 





-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Create-and-use-a-wrapper-class-in-java-tp5719072p5719075.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Create and use a wrapper class in java

2014-04-27 Thread fredvs
 Something like `java test` of rather `java TheWrapper`?

I did first compile both class with* javac test *and *javac TheWrapper.* =
ok, both compile without error...
Then i run *java test* and get the error message...

 try to get the wrapper class working with something that simply prints
 something to stdout (System.Out.println()

Hum, it is exactly what i try to do (for giving to fpc-wiki, with some
println(Hello world)...)



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Create-and-use-a-wrapper-class-in-java-tp5719072p5719077.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Create and use a wrapper class in java

2014-04-27 Thread fredvs
 Just a guess here, but what command did you use to run the `main class`?

Yep, Ewald, you get it (and me too) :-)

It seems that, indeed, i used the wrong run-parameter.

And guess what... IT WORKS.

Ok, Java is now completely in the basket of fpc libraries.
Time to present to the lucky Java people some wonderful fpc Java native
libraries.
And with the wrapper class included, ready to use, s'il vous plait.

Many thanks to Stephano and Ewald.

PS : ASAP, i will update the fpc wiki...



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Create-and-use-a-wrapper-class-in-java-tp5719072p5719078.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Create and use a wrapper class in java

2014-04-28 Thread fredvs
 PS : ASAP, i will update the fpc wiki... 

Done = http://wiki.freepascal.org/Using_Pascal_Libraries_with_Java



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Create-and-use-a-wrapper-class-in-java-tp5719072p5719082.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-02 Thread fredvs
 In general, libraries and threading is not an easy story. 

Ok,..., but what is your advice to do a  CallVoidMethod inside a thread ?

PS: Everything, inside the thread is working perfectly, only CallVoidMethod
does crash...

Do you think i could have better result with a kind of post-messages ?

Many thanks.

Fred



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Java-crash-when-fpc-library-CallVoidMethod-in-a-thread-tp5719098p5719113.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-03 Thread fredvs
 Did you use AttachCurrentThread and DetachCurrentThread?

Oops, what is that ? How must i use it ?

 Pay attention to the validity of local references as well as their
 number. 

Idem, what is local references as well as their number. ?

PS: Im a beginner with Java but, apart CallVoidMethod in threads, everything
is working as i want.

Many thanks.





-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Java-crash-when-fpc-library-CallVoidMethod-in-a-thread-tp5719098p5719118.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-03 Thread fredvs
 Posting some code might help. 

I may post code but not sure it will help.
The code is the same as
http://wiki.freepascal.org/Using_Pascal_Libraries_with_Java, section dealing
with callback procedure ( but inside a thread).

Hum, i would prefer some demo-working-code from somebody who knows how to do
it...

Many thanks.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Java-crash-when-fpc-library-CallVoidMethod-in-a-thread-tp5719098p5719119.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-26 Thread fredvs
Hello.
What is the best way to  unthread a procedure ?
I have try with a fptimer outside the thread but the thing that disturb me
is that you need a tcomponent as owner to create it.
And in the library i do not use any tcomponent...
How to create a fptimer without owner ?
I have try with fptimer.create(Nil) but without luck...
Thanks

PS: if you have a better idea how to unthread, im verry interessed



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Java-crash-when-fpc-library-CallVoidMethod-in-a-thread-tp5719098p5719400.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-26 Thread fredvs
Yep, Michael, thanks...
Ok then for Nil owner...
Hum, checksynchronize(), i do not realy understand how to use in the
thread/loop...
In the loop i do not use synchronize, because the procedure that is called
is a java/method  and synchronize is for procedure of object outside the
thread... (Or i miss something ).
Ps : this is the very last obstacle for total intégration into java (thread
are working perfect, only calling java/method iniside the thread is
problematic...)
Ps2 : maybe i have to forget to use thread inside a library (but if it is
possible then: whow...)




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Java-crash-when-fpc-library-CallVoidMethod-in-a-thread-tp5719098p5719402.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/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-29 Thread fredvs
Hello Sven, hello Michael = many tanks.

I have follow your advices... but...

I have then create a object and a procedure inside that object.
I use then queue() or synchronize()  inside the thread to execute that
procedure of object.
That procedure call CallvoidMethod.
OK, everything compiles but when queue() or synchronize() inside the thread
is called, now, ok, no crash but CallvoidMethod is not executed...
I have try also to use a fptimer(nil) (outside the thread) that uses, for
ontimer, a procedure that call CallvoidMethod but, same as queue() or
synchronize() inside the thread, no crash but the timer does not execute
CallvoidMethod at fptimer.ontimer...

PS : Im sure that CallvoidMethod is working and use the right parameters (if
a call CallvoidMethod outside the thread, directly (not via
fptimer.ontimer), the java method is executed..

@ Michael = of course, im hyper interested by your code

Many thanks.

Fred




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Java-crash-when-fpc-library-CallVoidMethod-in-a-thread-tp5719098p5719429.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-30 Thread fredvs
@ Ewald = thanks.
Hum, i did use checksynchronize but it did not help...
Must it be used with fptimer.ontimer too ?
And why fptimer.ontimer is not executed ?
Will i have more luck with other timer like epiktimer from Graeme (or the
new one from Michael) ?
Thanks.

PS : I will try with some more checksynchronize in main thread...



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Java-crash-when-fpc-library-CallVoidMethod-in-a-thread-tp5719098p5719431.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-30 Thread fredvs
re-@ Ewald :

 It *must* be called in the context of the main thread (the thread that
 loaded the library)

OOps, so do you mean that CheckSynchronize must be called by Java ?
So i have to add a custom procedure in the fpc library (who will be only a
fpc CheckSynchronize()) ?

Is it that that you mean, calling CheckSynchronize from the main Java class
(not from the main thread of the library) ?

Thanks.





-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Java-crash-when-fpc-library-CallVoidMethod-in-a-thread-tp5719098p5719433.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-30 Thread fredvs
Yep, yep, yep some very good news...

1) Added a new procedure in fpc library:
 = 
procedure uos_checksynchro(PEnv: PJNIEnv; Obj: JObject) ; cdecl;
begin
checksynchronize();
end; 

2) And, of course, in fpc library exported as:
 =
exports
...
uos_checksynchro name 'Java_uos_checksynchro', 
...

3) Added in Java wrapper class:
public static native void checksynchro();

4) In main Java application:
After that the fpc thread (who does a CallVoidMethod) was called by Java
(with  uos.play(0);):

= uos.checksynchro();

5) And guess what... The CallVoidMethod is executed...

So, first conclusion : it is possible to synchronize a CallVoidMethod inside
a thread but Java main thread must call fpc-checksynchronize().

Hum, so maybe, (im new in Java) use a Java-timer who calls
uos.checksynchro(); at regular time...

1) @ Ewald = Oops i read just your answer now, i will study it...
2) @ Ewald = i prefer your solution (if i can do it work) because i prefer
not oblige Java-users to use a Java-timer.

PS : All other solutions are welcome...

PS2 : All those problems of synchronize CallVoidMethod inside a thread are
problems only for uos (audio library).
For fpGUI library, no any problems (because fpGUI library does not use
threads...), those Java developers have now the best widgetset for their
Java applications.

PS3 : Hum, if one day, i need a fptimer in a fpc library, is it possible to
use fptimer.ontimer who works with Java ?

Many thanks.

Fred.






-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Java-crash-when-fpc-library-CallVoidMethod-in-a-thread-tp5719098p5719447.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-30 Thread fredvs
Please read my earlier post before this one

@ Ewald, i have try with :

 While true do
Begin
... code ...

CheckSynchronize;
End; 

But this does not work...

Thanks



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Java-crash-when-fpc-library-CallVoidMethod-in-a-thread-tp5719098p5719448.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-05-31 Thread fredvs
 The question here is: where did you type it? 
Inside the loop in thread, after each queue()... and also just before end of
thread.

 the next thing to go for, is probably be to try to get this
`CheckSynchronize;` integrated into java in a decent manner
 (applicable to most use cases, that is). Good luck with that :-)

Yep, but using a java-timer is not the best way to use the library.
One of the great feature of uos-unit (for fpc users), is all the
queue(procedure) at begin of thread, begin/end of the loop inside the thread
and at end of the thread.
But for the uos-library I could use a java-timer who do a
fpc-checksynchronize() at x interval, but it is not perfect because it
will always loose the x interval for synchronization...

So, every idea is welcome.

Many thanks.

Fred.






-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Java-crash-when-fpc-library-CallVoidMethod-in-a-thread-tp5719098p5719459.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-06-01 Thread fredvs
@ Ewald and Sven = many thanks ;-)

 The ideal thing would be to find some java mechanism that allows him to
`append` this checksynchronize to `the` main loop, some main-loop hook of
sorts.

Yep, i will be hyper-interested by that feature...

So, until that day will come, i will use a Java-timer in the main thread
(with the littlest reasonable x interval) who will call
CheckSynchronize()...

Many, many thanks for great advices...

Fred.

PS : Sorry to repeat... but fpc native libraries are much more accessible to
Java than equivalent C libraries... = mostly because of Pascal clarity and
huge help from fpc forum. Not sure that already exists C native library
accessible to Java that can do all what fpGUI or uos libraries can do...
(callback procedures, multi threads, dynamically load classical other
libraries,...).

Long life to fpc.





-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Java-crash-when-fpc-library-CallVoidMethod-in-a-thread-tp5719098p5719470.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Java crash when fpc library CallVoidMethod in a thread.

2014-06-18 Thread fredvs
 The ideal thing would be to find some java mechanism that allows him to
`append` this checksynchronize to `the` main loop, some main-loop hook
 of sorts.

Hum, if somebody have some idea how to implement it, he is very welcome to
show his way... ;-)

PS: By the other way, here some conclusions of this topic... (if something
is wrong, please advices...)
=
http://wiki.freepascal.org/Using_Pascal_Libraries_with_Java#Dealing_with_threads_and_synchronize_Java_method_inside_threads.

Thanks.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Java-crash-when-fpc-library-CallVoidMethod-in-a-thread-tp5719098p5719623.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Calling fpc libraries from other languages on freebsd/amd64 (bis)

2014-06-29 Thread fredvs
Hello.

I want to test some fpc libraries with freeBSD.

The compilation is ok but the library fail to run...

There was exactly the same problem in a earlier topic :

= http://lists.freepascal.org/pipermail/fpc-devel/2013-November/032950.html

Is it solved in trunk fpc version ?
Have try with FPC 2.6.4 but without luck...

Thanks.

Fred





-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Calling-fpc-libraries-from-other-languages-on-freebsd-amd64-bis-tp5719667.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Calling fpc libraries from other languages on freebsd/amd64 (bis)

2014-06-29 Thread fredvs
Ooops, i forget to note something...

My goal was to expose some pascal library to Java, of course those fpc
libraries follow the Java-native-library-way.

Those libraries loaded by a Java application work with Linux (tested on Mint
32/64) but fail to work with freeBSD...

Thanks.

Fred.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Calling-fpc-libraries-from-other-languages-on-freebsd-amd64-bis-tp5719667p5719668.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Calling fpc libraries from other languages on freebsd/amd64 (bis)

2014-07-03 Thread fredvs
Hello everybody...

Hum... no answers or no ideas ?

Thanks.

Fred



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Calling-fpc-libraries-from-other-languages-on-freebsd-amd64-bis-tp5719667p5719700.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Library does not compile on freeBSD

2014-08-01 Thread fredvs
Hello.

I have a library-code who compiles perfectly on Linux 32/64 and Windows
32/64 with fpc 2.7 trunk.

Sadly, when i try to compile same code on freeBSD with fpc 2.7 trunk too, i
get that error message :

 /usr/bin/ld: /usr/home/fred/fpGUI-develop/lib/x86_64-freebsd/fpg_base.o:
 relocation R_X86_64_32S
 against `RESSTR_$FPG_CONSTANTS_$$_RSKEYCTRL' can not be used when making
 a shared object;
 recompile with -fPIC

 /usr/home/fred/fpGUI-develop/lib/x86_64-freebsd/fpg_base.o: could not
 read symbols: Bad value

Compilation was done with -fPIC parameter...

What is wrong ?

Thanks.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Library-does-not-compile-on-freeBSD-tp5719852.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] LoadLibrary in freeBSD ?

2014-08-01 Thread fredvs
Hello.

I try to load a linux-library in freeBSD with
DynLibs.LoadLibrary(libfilename) but it does not load...

Must the loaded library be pure freeBSD library ? 

I was thinking that freeBSD is able to run Linux applications.

Is it not true for libraries or must i install something in freeBSD to
accept Linux libraries?

Or, maybe, change something in fpc code ?

Thanks.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/LoadLibrary-in-freeBSD-tp5719853.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] LoadLibrary in freeBSD ?

2014-08-01 Thread fredvs
Yep, i have some news from freeBSD.

I have installed linux_base-f10 (linux emulator) but it seams that freeBSD
can load only 32-bit-libraries.

Here some comment from freeBSD site :


FreeBSD provides 32-bit binary compatibility with Linux®, allowing users to
install and run most 32-bit Linux® binaries on a FreeBSD system without
having to first modify the binary. It has even been reported that, in some
situations, 32-bit Linux® binaries perform better on FreeBSD than they do on
Linux®.

However, some Linux®-specific operating system features are not supported
under FreeBSD. For example, Linux® binaries will not work on FreeBSD if they
overly use i386™ specific calls, such as enabling virtual 8086 mode. In
addition, 64-bit Linux® binaries are not supported at this time.


Aaarg, i have install fpc-freeBSD-64-bit.

Maybe with fpc-freeBSD-32-bit applications (on a freeBSD-64-bit system?) and
Linux-libraries-32-bit will do the trick ?

Or, perhaps, is it possible to load Linux-libraries-32-bit with
fpc-freeBSD-64bit applications ?

Thanks.







-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/LoadLibrary-in-freeBSD-tp5719853p5719854.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/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Library does not compile on freeBSD

2014-08-02 Thread fredvs
Hello.

Thanks to Graeme, it is possible to compile libraries on freeBSD  ;-)

The solution :=

Implementation
{$IFDEF FREEBSD}
// These are missing for FreeBSD in FPC's RTL
const
S_IRWXU =  S_IRUSR or S_IWUSR or S_IXUSR;
S_IRWXG =  S_IRGRP or S_IWGRP or S_IXGRP;
S_IRWXO =  S_IROTH or S_IWOTH or S_IXOTH;
{$ENDIF}


Not yet tested with fpc 2.7.1 but works with fpc 2.6.4

Many, many, many, many thanks Graeme.

Fred





-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Library-does-not-compile-on-freeBSD-tp5719852p5719856.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] LoadLibrary in freeBSD ?

2014-08-02 Thread fredvs
Thanks Marco, thanks for your light ;-)

Now that i can compile freeBSD libraries (see my last other topic), i will
use that libraries (in place of Linux libraries).

Write you later with the (positive, sure) results.

Fred.




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/LoadLibrary-in-freeBSD-tp5719853p5719857.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Library does not compile on freeBSD

2014-08-02 Thread fredvs
Hello.

A other issue comes from lpk packages.
Here answer from Super-Graeme that solve my problems... =


...
The classic down side of using Lazarus Packages (*.lpk files). You
applied a new compiler option to your project, but Lazarus doesn't apply
that to any packages you are using. Same goes for enabling/disabling
debug info etc.  Hence I am moving away from Lazarus Packages and using
path macros like Maximus IDE and MSEide does. I think with newer Lazarus
IDE you can somehow do it, but I find the new build modes dialog too
confusing, so haven't bothered figuring it out yet.
 
To solve you problem, define all fpGUI Toolkit paths in your project -
removing the fpgui_toolkit.lpk dependency. Or add -fPIC to the
fpgui_toolkit.lpk compiler options and recompile that as well.
 
Regards,
  - Graeme -
 



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Library-does-not-compile-on-freeBSD-tp5719852p5719858.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Calling fpc libraries from other languages on freebsd/amd64 (bis)

2014-08-02 Thread fredvs
 Is it solved in trunk fpc version ?
Why don't you try? 

I have install a brand new trunk version of fpc 2.7.1 64 bit on freeBSD 10
64 bit.

The library was successfully compiled.

But, sadly, i get hat error message while trying to run a java application
who use the library (that java application works in linux) :=

[fred@pcbsd-fred] ~/fpGUIlib/demos/demo_Java% java -Djava.library.path=./
fpg_demo

Exception in thread main java.lang.UnsatisfiedLinkError:
/usr/home/fred/fpGUIlib/demos/demo_Java/libfpgui.so:
/usr/home/fred/fpGUIlib/demos/demo_Java/libfpgui.so: Undefined symbol
operatingsystem_parameter_envp
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1929)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1847)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1119)
at fpg_demo.main(fpg_demo.java:148)

;-(

So, fpc 2.7.1 does not do the trick...

What can i do ?

Thanks



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Calling-fpc-libraries-from-other-languages-on-freebsd-amd64-bis-tp5719667p5719861.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Calling fpc libraries from other languages on freebsd/amd64 (bis)

2014-08-03 Thread fredvs
 Start providing source code so people can follow what you are trying to
 do instead of having to guess would be a nice step ;) 

First, fpGUI must be installed =
 https://github.com/graemeg/fpgui/tree/develop

Then. go there =
 https://github.com/fredvs/fpGUIlib

- Click on Download Zip. (middle/end of page) and unzip it.

- In /fpGUIlib/src/ change in extrafpc.cfg the directory of fpGUI according
yours. (maybe read ReadMe.txt, it is explained).

- And finally compile the library In /fpGuilib/src/ =

$ fpc @extrafpc.cfg fpgui.pas

Thats all for compilation.

___

Now test the library:

Copy the new compiled library /src/libfpgui.so into
 ~/fpGUIlib/demos/demo_Java

Then run the java demo with:
-In terminal do:

- cd ~/fpGUIlib/demos/demo_Java  (go in java demo path)

- java -Djava.library.path=. fpg_demo

When i try to run it on freeBSD, i get error messages...

Many thanks to help.

Fred
- 
PS: If you try the same things with Linux, it should work. (for me it
works).



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Calling-fpc-libraries-from-other-languages-on-freebsd-amd64-bis-tp5719667p5719864.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Calling fpc libraries from other languages on freebsd/amd64 (bis)

2014-08-03 Thread fredvs
Ooops, in last topic, branch freebsd-fixes must be selected...
Here re-explaination from sctatch =

  Start providing source code so people can follow what you are trying to
 do instead of having to guess would be a nice step ;)

First, fpGUI must be installed =
 https://github.com/graemeg/fpgui/tree/develop

Then. go there =
 https://github.com/fredvs/fpGUIlib

Select branch: = freebsd-fixes

- Click on Download Zip. (middle/end of page) and unzip it.

- In /fpGUIlib/src/ change in extrafpc.cfg the directory of fpGUI according
yours. (maybe read ReadMe.txt, it is explained).

- And finally compile the library In /fpGuilib/src/ =

$ fpc @extrafpc.cfg fpgui.pas

Thats all for compilation.

___

Now test the library:

Copy the new compiled library /src/libfpgui.so into
 ~/fpGUIlib/demos/demo_Java

Then run the java demo with:
-In terminal do:

- cd ~/fpGUIlib/demos/demo_Java  (go in java demo path)

- java -Djava.library.path=. fpg_demo

When i try to run it on freeBSD, i get error messages...

Many thanks to help.

Fred
-
PS: If you try the same things with Linux, it should work. (for me it
works).




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Calling-fpc-libraries-from-other-languages-on-freebsd-amd64-bis-tp5719667p5719865.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Calling fpc libraries from other languages on freebsd/amd64 (bis)

2014-08-03 Thread fredvs
Yes, it is still me...

You may try the compiled and binary java demo for Linux 64 bit :=
  https://sites.google.com/site/fiensprototyping/demo_Java.tar.gz

Download and unzip the demo.

Then :=

-In terminal do:

- cd /demo_Java   (go in java demo path)

Then run it with:

- java -Djava.library.path=. fpg_demo

It is a demo for Linux 64 bit.
The same demo, with fpGUIlib.so compiled on freeBSD does not work...



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Calling-fpc-libraries-from-other-languages-on-freebsd-amd64-bis-tp5719667p5719866.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Calling fpc libraries from other languages on freebsd/amd64 (bis)

2014-08-04 Thread fredvs
Aaaargh, difficult t find help here...

In the original thread 
 [fpc-devel] (hack) calling fpc libraries from other languages on
 freebsd/amd64
 of Michal Wallace michal.wallace at gmail.com 

Michael Wallace said that he has find the solution :=

 Anyway, the problem appears to be in this file:
 http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/rtl/freebsd/x86_64/dllpr=

(But this file is no more accessible. ;-( )

 It has the comment:

 # FreeBSD RunTime dynamic loader only
 # calls the functions specified by -init
 # as functions without parameters
 # Thus, it is not possible to retrieve argc, argv and envp
 # On x86_64 CPU, using weak for the operatingsystem_parameter_XXX

 # allows to bind to main program parameters,
 # but this does not seem to work for i386 loader.

 Then at the bottom:

 /* Do not fail linkage if argc, argv and envp are not found. */
 .weak operatingsystem_parameter_argc
 .weak operatingsystem_parameter_argv
 .weak operatingsystem_parameter_envp

 My change was to comment these lines out and copy the lines from prt0.as
 :


 .global operatingsystem_parameter_envp
 .global operatingsystem_parameter_argc
 .global operatingsystem_parameter_argv
 .set operatingsystem_parameter_envp,operatingsystem_parameters+0
 .set operatingsystem_parameter_envp,operatingsystem_parameters+0
 .set operatingsystem_parameter_envp,operatingsystem_parameters+0

 Then after recompiling fpc, I was able to compile a *.so file usable from
 python.

 But... It seems like the original .weak version was done quite
 deliberately, so I suspect that if I submit a patch, it would break
 things for other people. OTOH, I'd like to get a fix for my issue
 into trunk.

So, it seems that Michal Wallace do not sent a patch for that.
It seems too that his solution was for Python, maybe it works for Java too.

But later Sergei Gorelkin answers :

 Studying sources of FreeBSD dynamic loader reveals that, although it does
 not pass argc, argv and 
 envp to the initialization function in .init section, it *does* pass them
 to procedures pointed to 
 from .init_array section. Generally, .init_array is considered as a
 replacement for .init. 
 Therefore, the correct solution would be to change initialization to use
 .init_array and remove all 
 associated hacks.

 Regards,
 Sergei

So i do not know where is the good solution, please, wonderful fpc people,
help us and me...

Fred





-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Calling-fpc-libraries-from-other-languages-on-freebsd-amd64-bis-tp5719667p5719869.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] fpc Libraries do not work in freeBSD

2014-08-04 Thread fredvs
Hello.

Fpc library compiled on freeBSD are unusable.
Python, Java and even fpc applications can not use them...

Look at that  (works with Linux): =

 The fpc library :=

library test ;
{$mode objfpc}

procedure fpctest();
begin
writeln('OK, it works...');
end;

exports
fpctest name 'fpctest';

begin
end.


 The Python script :=
//
#file fp_test.py
import string 
import os,sys,platform
dia = sys.path[0]
from ctypes import*
fp_lib = libtest.so
fppathdll = os.path.join( dia , fp_lib)
fpdll = cdll.LoadLibrary(fppathdll)
fpdll.fpctest


Run the script
 python fp_test.py

= same error if library used by Python, Java or fpc applications:

 ~/libtest.so: Undefined symbol
 operatingsystem_parameter_envp 

How can i help to fix that ?

Thanks.

Fred.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/fpc-Libraries-do-not-work-in-freeBSD-tp5719870.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] http://free-pascal-develop.nabble.com/ ?

2014-08-05 Thread fredvs
Hello.

For fpc-general it exists :
http://free-pascal-general.1045716.n5.nabble.com/

Nable is  a easy to use forum-web site.

Does it exist a nabble web page for fpc-develop (with all fpc-devel
archives) ?

Thanks.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/http-free-pascal-develop-nabble-com-tp5719880.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] http://free-pascal-develop.nabble.com/ ?

2014-08-06 Thread fredvs
 I'm the one who registered FPC general to Nabble a couple of years ago. 

Many thanks, Leledumbo. I find it very useful, sometimes i check fp-general
mailing list from foreign computers, with Nabble i may respond too ;-)

 might want to register FPC develop as well. 

Hum, im already registered to fpc-develop mailing list. Nabble for
fpc-develop will be welcome. 

(Yep, i know your answer ;-) = Why dont you do it by yourself ? = OK, when
i find time, i will do it...)

Fred

Thanks



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/http-free-pascal-develop-nabble-com-tp5719880p5719884.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] LoadLibrary(freeBSDlibrary) does not work...

2014-08-21 Thread fredvs
Hello.

I try to dynamically load libraries in freeBSD 64 bit with
DynLibs.LoadLibrary(reeBSDlibrary), with a fpc-64-bit-freeBSD application
(compilation has no errors.)

But at LoadLibrary(freeBSDlibrary), program crash... ;-)

Here the error message from gdb =

 Program received signal SIGSEGV, Segmentation fault.
 [Switching to Thread 808406400 (LWP 100359/deviceinfos)]
 0x in ?? ()

I have try on a simple fpc-64-bit-freeBSD application to load
64-bit-freeBSD-libraries, 32-bit-freeBSD-libraries and
32-bit-Linux-libraries. = all crash...

Is the problem known and does it exist a solution ?

Thanks.

PS: I have experience on using DynLibs.LoadLibrary, i do not have that
problem with Windows, Linux and OSX.

Fred



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/LoadLibrary-freeBSDlibrary-does-not-work-tp5719943.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] LoadLibrary(freeBSDlibrary) does not work...

2014-08-21 Thread fredvs
Hum, little rectif... 

It seems that LoadLibrary is not the guilty. I was able to dynamically load
some freeBSD 64 bit libraries.

The crash comes somewhere else, (maybe from DynLibs.GetProcedureAddress).

I will do more investigations to find what is wrong with dealing libraries
for fpc applications in freeBSD.

Write you later...



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/LoadLibrary-freeBSDlibrary-does-not-work-tp5719943p5719944.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] freeBSD and GetProcedureAddress() ?

2014-09-03 Thread fredvs
Hello everybody.

Hum, i try to dynamically load (and run) some freeBSD libraries with a
fpc-freeBSD-appliction.

For testing, i use some library included in /usr/lib (so im sure that the
library is working on freeBSD).

Those test is fully working with Linux.

I can load the library with DynLibs.LoadLibrary(libfilename) in feeBSD.

I can get the procedure address with DynLibs.GetProcedureAddress() in
freeBSD = pointer
is  nil. = seems ok.

But if i try to use that procedure, fpc application crash (without any
useful
message from debugger).

Now the questions:
1) Has somebody try to make a fpc application that use dynamically loaded
libraries in freeBSD?
2) If yes, what was the result, was it OK ?
3) If 2) = OK = how did you do it ?

Many thanks.

Fredf



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/freeBSD-and-GetProcedureAddress-tp5719977.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Free Pascal Directories

2014-10-06 Thread fredvs
Hello.

I use Geany and fpGUI for ages now. ;-)

All you have to do =

In Geany:

- Click on Define construct command = In Compile command = fpc %f
@extrafpc.cfg

extrafpc.cfp is a text file with all your -fu and -fi needed.

Here example of a fpGUI extrafpc.cfg =



-fPIC
-Fi/home/fred/fpGUI-develop/src/
-Fi/home/fred/fpGUI-develop/src/corelib/
-Fi/home/fred/fpGUI-develop/src/corelib/x11/
-Fu/home/fred/fpGUI-develop/src/
-Fu/home/fred/fpGUI-develop/src/corelib/
-Fu/home/fred/fpGUI-develop/src/gui/
-Fu/home/fred/fpGUI-develop/src/corelib/x11/
-FUunits/
-FE./



Fred



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Free-Pascal-Directories-tp5720212p5720322.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpGUI Thread-safe

2014-10-15 Thread fredvs
i use lot of (complicated) threads with fpGUI = works perfect and no
problems...

I even have done hard-core test.

The only thing that i noticed is when using synchronize() with fpc  2.7.1
= i have better synchronization with fpGUI-build-in postmessage().

If queue() (fpc = 2.7.1) is used = absolutely perfect synchronization.

Fred.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/fpGUI-Thread-safe-tp5720361p5720362.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cross-compile vs native

2015-01-28 Thread fredvs
Hello.

I do main development on Linux 64.

For Windows, i use wine on Linux 64, (fpc.exe 32/64 installed without
problem) and compile the source via wine-fpc.exe.

The advantage is that you do not have to copy your source to a virtual
machine or a other native Windows.
And you may test your exe too on the same system ;-)

Fred



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Cross-compile-vs-native-tp5720834p5720850.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Cross-compile vs native

2015-01-30 Thread fredvs
You may also install Lazarus.exe via wine. 
With the SeupLazarus.exe, it install fpc.exe too ;-)



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Cross-compile-vs-native-tp5720834p5720891.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] SDL_Net vs Synapse

2015-01-05 Thread fredvs
Hello Sandro and many thanks for the link.

Hum, i do not know SDL, is it a alternative to PortAudio ?
Does it deal with mp3 and other audio formats ?

Thanks.

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/SDL-Net-vs-Synapse-tp5720715p5720719.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Internet audio streaming ?

2015-03-16 Thread fredvs
Hello.

I have some problem with audio internet streaming.
I would like to do it with mpg123 + portaudio libraries but...

Here is the procedure used by mpg123 = 
mpg123_open_fd = function( mh:Tmpg123_handle; fd: Integer).

I have sent to mpg123-forum that question =

 Hello and congratulation for your superb library.
 In your doc you say that, for use of internet streaming, it is better to
 use
 mpg123_open_fd = function( mh: Tmpg123_handle; fd: Integer).
 OK but i do not understand what is fd parameter.
 Is it the ip address ? Because it is type of integer. ???
 Many thanks

Here their answer =

 The parameter is a file descriptor you obtained from opening the HTTP
 connection yourself.
 There is no HTTP code in libmpg123 itself.

Hum, how can i obtain such of file descriptor ?
And how to open a HTTP connection ?
There is a new feature in fpc 3.x.x = a http client.
Could it do the job ?

PS: I have the fpc headers for mpg123 and portaudio libraries.
There are working perfectly with fpc = can play local *.mp3 without
problem.

Thanks.

Fre;D




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Internet-audio-streaming-tp5721358.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] File Descriptor in Windows ?

2015-03-22 Thread fredvs
@ Andrew

 Check for writeln's in the htmlthread unit you added.

Hum, i did not add htmlthread unit (only fphttpclient and pipes).
What do you mean ?  

@ Martin
 It should work, because TProcess relies on this function to do it's job.

Yes, maybe, but it does not work ;-(
Could it be a problem of conversion into file descriptor ?
It seems that fle descriptor are posix and unix only...
Microsoft added support to  for open/write, but renamed the (non-C-standard)
functions to _open/_write.

Aaargh, Microsoft, you are so lonely

Fre;D




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/File-Descriptor-in-Windows-tp5721448p5721464.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] File Descriptor in Windows ?

2015-03-22 Thread fredvs
 Check for writeln's in the htmlthread unit you added.

Oops, i think i get it (sorry it is Sunday). ;-(
 
- CreatePipeHandles (InHandle,OutHandle, PipeBufferSize);
- Writeln('Input Handle = ' + inttostr(InHandle) + ' Output Handle = ' +
inttostr(OutHandle));
= Linux = Input Handle = 3 Output Handle = 4
= Windows = Input Handle = 212 Output Handle = 216

- Output:=TOutputPipeStream.Create (OutHandle);
- if Output = nil then  writeln('=== NO Pipe Stream created.') else
- writeln('=== Output Pipe Stream created.');
= Linux + Windows = === Output Pipe Stream created.

-  err := mpg123_open_fd(MyMPHandle, InHandle);
- if err = 0 then writeln('=== mpg123_open_fd = ok.') else
   writeln('=== mpg123_open_fd NOT ok.') ; 
= Linux + Windows = mpg123_open_fd = ok. 

- err := mpg123_read(MyMPHandle, blabla);
- writeln('=== mpg123_read error = ' + inttostr(err)) ;
= Linux = mpg123_read error = 0 = no error
= Windows = mpg123_read error = 12 = Invalid RVA mode

Ooops, what is RVA mode?...

Thanks.

Fred.







-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/File-Descriptor-in-Windows-tp5721448p5721466.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] File Descriptor in Windows ?

2015-03-22 Thread fredvs
Yep, there is a answer from mpg123 creator in forum list ;-) =

 In Linux, no problem, i use the Input-Handle of a pipe as file
 descriptor.
 = mpg123_open_fd(MyMP123Handle, InputHandle)
 But if using Input-Handle of a pipe in Windows, at mpg123_read() i get
 that error:
 MPG123_BAD_RVA
 
 What does it mean ?

 Are you mixing C runtimes? A libmpg123 DLL from MinGW and your code built
 with Visual C?
 I reckon that those file descriptors may not be compatible. I don't have a
 Windows system running myself.

Ok, conclusion of the story = fpc is perfect and not the guilty  ;-)

Now, i have to make that descriptors compatible. ;-(

Many thanks.

Fre;D





-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/File-Descriptor-in-Windows-tp5721448p5721467.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] fpHttpClient and Https support ?

2015-03-20 Thread fredvs
Hello.

First of all, congratulation for fpHttpClient.pas.
It works directly, like charms, without to install any dependencies. = wow.

I am able to do internet audio streaming with it, perfect. ;-)

Hum, while trying to access Https sites, i get errors. ;-(

In begin of fpHttpClient.pas, there is =

 Todo:
  * Https support.  

Could it be part of the problem ?
Are there plan to enable Https support ?

Thanks.

Fre;D




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/fpHttpClient-and-Https-support-tp5721435.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpHttpClient and Https support ?

2015-03-21 Thread fredvs
Excellent, thanks.

PS : Do you remember a old topic in Lazarus forum about uos and internet
audio streaming ?
(It was you who converts and helps me to install uos to GitHub).

Now uos does internet audio streaming !

= https://github.com/fredvs/uos

Thanks Sergio.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/fpHttpClient-and-Https-support-tp5721435p5721442.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpHttpClient and Https support ?

2015-03-21 Thread fredvs
 And, by the way, who may i thank for that excellent fpHttpClient.pas ?

 I plead guilty.

 Michael. 

Ha, so MANY THANKS Michael for your excellent. brilliant and easy to use 
fpHttpClient.pas

Fre;D




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/fpHttpClient-and-Https-support-tp5721435p5721445.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpHttpClient and Https support ?

2015-03-21 Thread fredvs
Ooops, in earlier topic = Thanks Silvio. ;-)

And, by the way, who may i thank for that excellent fpHttpClient.pas ?

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/fpHttpClient-and-Https-support-tp5721435p5721443.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] File Descriptor in Windows ?

2015-03-21 Thread fredvs
Hello.

Added Pipes in uses section.

Changed = AssignPipe(InHandle, FOutHandle);
Into = CreatePipeHandles (InHandle, FOutHandle, PipeBufferSize);  

Then in code =
var
  Http: TFPHTTPClient;
  Output: THandleStream = nil;
  URL: String;
begin
  Http := TFPHTTPClient.Create(nil);
  Output := THandleStream.Create(FOutHandle);
  URL := FWantedURL;
   Http.RequestHeaders.Clear;
  Http.Get(URL, Output);

= Perfect for Linux, compiles + web procedure runs perfectly (like using
fpPipe).

In Windows, same code compiles ok but when trying to run the web procedure,
Program gives that error =

 An unespected error occurred
 File not open

? ;-(

Fre;D 
   



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/File-Descriptor-in-Windows-tp5721448p5721451.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] File Descriptor in Windows ?

2015-03-21 Thread fredvs
Hello.

In Unix systems File Descriptor can be created with fpPipe(FDInput,
FDOutput).
Then FDInput/FDOutput may be used as file descriptors.
Ok, perfect.

But fpPipe is part of BaseUnix/Unix... 

So the question is:

How to create such of File Descriptor with Windows?...

Many thanks.

Fre;D


1) - Use fpPipe in BaseUnix/Unix to create a fifo.
2) - Create a THandleStream using the returned input value of fpPipe.
3) - Use mpg123_open_fd from the output value from fpPipe
4) - Use an instance of TfpHttpClient.Get(YourURL, AHandleStream) to
 retrieve the stream. 



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/File-Descriptor-in-Windows-tp5721448.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] File Descriptor in Windows ?

2015-03-21 Thread fredvs
 Hello.

 In Unix systems File Descriptor can be created with fpPipe(FDInput,
 FDOutput).
 Then FDInput/FDOutput may be used as file descriptors.
 Ok, perfect.

 But fpPipe is part of BaseUnix/Unix...

 So the question is:

 How to create such of File Descriptor with Windows?...

See unit pipes, there is a platform-independennt call:
Function CreatePipeHandles (Var Inhandle,OutHandle : THandle;
APipeBufferSize : Cardinal = 1024) : Boolean;

There is a second function which creates TStreams descendents.

Michael. 

Ooops, so fast and so good !
I will try it now.
Write you later.

Many thanks.

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/File-Descriptor-in-Windows-tp5721448p5721450.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] File Descriptor in Windows ?

2015-03-21 Thread fredvs
Re-hello.

Tried with this too =

Change =  Output: THandleStream = nil; 
into  = Output: TOutputPipeStream = nil;

and

Change = Output := THandleStream.Create(FOutHandle);
into =   Output:=TOutputPipeStream.Create (FOutHandle); 

= Compiles + works perfect in Linux ;-)

= Compiles ok but does not work on Windows ;-(
(file not open)

?

Thanks.

Fred;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/File-Descriptor-in-Windows-tp5721448p5721452.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] File Descriptor in Windows ?

2015-03-21 Thread fredvs
 What do you do with the inHandle ?
 Michael. 

It is used by mp123 mp3-decoder library.

=function mpg123_open_fd(mph: Tmpg123_handle; fd: integer);

fp (file descriptor) := InHandle ;

It seems that InHandle as file descriptor does not work on Windows.
But in *nix system, it works.





-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/File-Descriptor-in-Windows-tp5721448p5721454.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Internet audio streaming ?

2015-03-19 Thread fredvs
Hello everybody and thanks for so much answers.

By the way, Andrew Haines explained how to do.

1) - Use fpPipe in BaseUnix/Unix to create a fifo.
2) - Create a THandleStream using the returned input value of fpPipe.
3) - Use mpg123_open_fd from the output value from fpPipe
4) - Use an instance of TfpHttpClient.Get(YourURL, AHandleStream) to
 retrieve the stream.

And... it works ;-)

Many, many thanks to Andrew.

PS:Andrew has done a excellent work with his PulseAudio wrapper =
https://github.com/andrewd207/fpc-pulseaudio

Fre;D.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Internet-audio-streaming-tp5721358p5721415.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] File Descriptor in Windows ?

2015-03-25 Thread fredvs
Hello.

Sorry to sorry to bother you with that file descriptors again... ;-(

There are some answers there on mpg123 forum.
They explain that simple stdin/stdout file descriptors would work.
Of course all what they explained is in C ;-(

OK, but how can i use simple stdin/stdout file descriptors in Pascal ?
What is the code to retrieve that stdin/stdout file descriptors in Windows?

Many thanks.

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/File-Descriptor-in-Windows-tp5721448p5721489.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] File Descriptor in Windows ?

2015-03-25 Thread fredvs
 It's not if developers wouldn't decide to make their libraries so *nix
centric...

Or when they will decide to develop their libraries with something else than
C, that gives them compilers choice that are not compatible together (a
library compiled with CGwin is not compatible with one compiled with one
compiled with Visual Studio.)

The good idea will be to choose for a compiler more cross-platform... like
fpc. ;-)

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/File-Descriptor-in-Windows-tp5721448p5721500.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] File Descriptor in Windows ?

2015-03-25 Thread fredvs
@ Michael =
 They are available in default variables in the system unit:
 StdInputHandle,StdOutputHandle,StdErrHandle 

Yep, good to know, thank-you ;-)
Sadly, it does not solve the problem... ;-(

@ Andrew
 you could use mpg123_replace_reader_handle and mpg123_open_handle

Ok, good idea, i will study it... ;-)

Hum,... by the way,.. if,.. fortuitously (and by chance) you have already
try it with your PulseAudio wrapper, could it be possible to show some code
?

Many thanks.

Fre;D

PS: Why everything must be so compilcated with Windows ?









-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/File-Descriptor-in-Windows-tp5721448p5721497.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] File Descriptor in Windows ?

2015-03-25 Thread fredvs
 @ Andrew
 Hum,... by the way,.. if,.. fortuitously (and by chance) you have already
 try it
 with your PulseAudio wrapper, could it be possible to show some code ?

Ooops, i just check my mail now and =...
Andrew, you are a Angel ;-)

Tetra billion of thanks.

PS: I will test it and give you news by email.

Thanks to everybody.

Fre;D




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/File-Descriptor-in-Windows-tp5721448p5721498.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] File Descriptor in Windows ?

2015-03-26 Thread fredvs
Hello.

For info, here answer from mpg123 creator =
__

 4) Assisgn input pipe stream = 
   mpg123_open_fd(MyMPHandle,InHandle);  
   = Crash on Windows, OK on Linux.

I don't have my head wrapped around the pascal bindings, but are you
handing your pipe handle to mpg123_open_fd() without change? What
should the mpg123 C code, expecting a C library file descriptor, do
with your handle created in Pascal/Delphi with whatever runtime in the
background? File descriptors may be compatible, but don't have to.

If that is really the case here, it would be best not to include
mpg123_open_fd() in a Pascal binding at all, or altenatively, make it a
wrapper that actually used mpg123_open_handle() and handles the I/O
conversion itself.

As I said, I didn't look closer, but it appears to me that you're just
lucky on Linux since Pascal and C share more runtime environment.


Alrighty then,

Thomas





-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/File-Descriptor-in-Windows-tp5721448p5721507.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Use sleep in thread

2015-03-01 Thread fredvs
Ooops, in previous mail you should read (sorry)=

 there are dire warnings that  TThread.Create()  shouldn't be overridden.
 Should this be in the documentation if it's a significant issue?

 It's the first time I hear it, I've been doing it forever, just like in
 the example in the same wiki page.

Hum... same for me here... ;-(

Do you think it could explain memory leak that i cannot solve even using
this ? =

  constructor TMyThread.Create(CreateSuspended: boolean;
  const StackSize: SizeUInt);
 begin
  inherited Create(CreateSuspended, StackSize);
  FreeOnTerminate := TRUE ;  = (changed) this not working ?
...
end;  

Thanks.

Fred 





-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Use-sleep-in-thread-tp5721119p5721177.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Use sleep in thread

2015-03-01 Thread fredvs
 there are dire warnings that  TThread.Create()  shouldn't be overridden.
 Should this be in the documentation if it's a significant issue?

 It's the first time I hear it, I've been doing it forever, just like in
 the example in the same wiki page. 

Hum... same for me here... ;-(

Do you think it could explain memory leak that i cannot solve even using
this ? =

  constructor TMyThread.Create(CreateSuspended: boolean;
  const StackSize: SizeUInt);
 begin
  inherited Create(CreateSuspended, StackSize);
  FreeOnTerminate := false;  = this not working ?
...
end;  

Thanks.

Fred  



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Use-sleep-in-thread-tp5721119p5721176.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Use sleep in thread

2015-02-25 Thread fredvs
Hello.

You may use RTLEvents to pause a thread. =

Program Project1;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}
  cthreads,
  {$ENDIF}
  Classes;

Type

  { THelloThread }

  THelloThread = class(TThread)
fSleepTime,fThreadNum:integer;
fEvent:PRTLEvent;
procedure Execute; override;
constructor Create(sleepTime,threadNum:integer);
destructor Destroy; override;
  end;

var

  ThreadArray:array[1..10] of THelloThread;

{ THelloThread }

procedure THelloThread.Execute;
begin
  while true do
  begin
writeln('Thread ',fThreadNum,' sleeping for ',fsleepTime,' ms');
RTLeventWaitFor(fEvent,fSleepTime);
if Terminated then break;
//don't forget to reset,
RTLeventResetEvent(fEvent);
writeln('Hello From Thread ',fThreadNum);
  end;
  writeln('Bye from ',fThreadNum);
end;

constructor THelloThread.Create(sleepTime,threadNum: integer);
begin
  inherited Create(true);
  FreeOnTerminate := true;
  fEvent := RTLEventCreate;
  fSleepTime := sleepTime;
  fThreadNum := threadNum;
  Start;
end;

destructor THelloThread.Destroy;
begin
  RTLeventdestroy(fEvent);
  inherited Destroy;
end;

procedure CreateThreads;
var
  l:integer;
begin
  for l := low(ThreadArray) to high(ThreadArray) do
ThreadArray[l] := THelloThread.Create(l*1000,l);
end;

procedure StopThreads;
var
  l:integer;
begin
  for l := low(ThreadArray) to high(ThreadArray) do
  begin
ThreadArray[l].Terminate;
RTLeventSetEvent(ThreadArray[l].fEvent); //wake event up for early
terminattion
ThreadArray[l].WaitFor;
  end;
end;

begin
  CreateThreads;
  writeln('Press Any Key To Stop.');
  readln;
  StopThreads;
  writeln('All threads stopped');
  readln;
end.



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Use-sleep-in-thread-tp5721119p5721129.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Internet audio streaming ?

2015-03-19 Thread fredvs
Hello Andrew.

I am very interested by your PulseAudio bindings.

Hum, how many dependencies has PulseAudio ?
Could it be possible (like for PortAudio) to only dynamically load
pulseaudio.so library ?
Or does PulseAudio need to be installed because of too many dependencies ?

Is PulseAudio usable for other systems than Linux ?

Many thanks.

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Internet-audio-streaming-tp5721358p5721418.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Using Cairo lib on Linux without X

2015-04-08 Thread fredvs
 Where is it? 

Hum, from previous mail ;) =

You may download src from =
= http://cairographics.org/releases/cairo-1.14.2.tar.xz 
= unzip it.
= $ cd cairo-1.14.2
= $ ./configure --disable-libX11 (or --disable-X11 ?) (or --enable-X11=no
?)
= $ make
= $ sudo make install

Fre;D 



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Using-Cairo-lib-on-Linux-without-X-tp5721574p5721586.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Using Cairo lib on Linux without X

2015-04-07 Thread fredvs
 If you build the library from source, you can select
 various output streams during the configure script.

=

$ sudo apt-get build-dep cairo
$ cd cairo
$ ./configure --disable-libX11
$ make
$ sudo make install

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Using-Cairo-lib-on-Linux-without-X-tp5721574p5721578.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Using Cairo lib on Linux without X

2015-04-08 Thread fredvs
 $ sudo apt-get build-dep cairo 
 Interesting. That works in Ubuntu but not in Mint.
 They are more and more distinct.

Ooops, indeed, just try on my Mint 17 = E: Impossible to find source for
cairo package... 

 I guess I must download the Cairo sources from somewhere before doing cd
 cairo.

Yep, usually i use sudo apt-get build-dep xxx but it does not work any
more...

You may download src from =
= http://cairographics.org/releases/cairo-1.14.2.tar.xz 
= unzip it.
= $ cd cairo-1.14.2
= $ ./configure --disable-libX11 (or --disable-X11 ?) (or --enable-X11=no
?)
= $ make
= $ sudo make install

Fre;D













-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Using-Cairo-lib-on-Linux-without-X-tp5721574p5721582.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] loadlibrary() unsafe ?

2015-06-20 Thread fredvs
Hello.

Sorry to come back with that story... ;-(

I have used inside a script LD_LIBRARY_PATH` and at end runs the espeak
executable.

So a Tprocess run the script.

Ok, it works but... now i do not have access to espeak anymore, not possible
to cancel the speech.

AProcess.terminate has impact on the script but not on what has done by the
script.

So, the loadlibrary() approach is more efficient because the process runs
espeak directly = so possible to cancel it...

Does it really have problems to use that loadlibrary()  approach ?

Ok maybe first a process that run a script for assign path of lib and then a
other process to run espeak ?

Many thanks.

Fre;D









-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/loadlibrary-unsafe-tp5721801p5721856.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Multipe path in TProcess.Environment ?

2015-06-21 Thread fredvs
@ Thomas = tanks for answer.

 Unix uses a colon as path delimiter, not semicolon. I don't know about
 LD_PRELOAD, but it should work at least for LD_LIBRARY_PATH. 

Ha, ok... (by the way, what character is colon ?)

So LD_PRELOAD and LD_LIBRARY_PATH are unix only ?
What about Windows, what should be the TProcess.Environment.Text ?

Many thanks.

Fre;D




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Multipe-path-in-TProcess-Environment-tp5721893p5721898.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Multipe path in TProcess.Environment ?

2015-06-21 Thread fredvs
Hello.

If a TProcess runs a executable who needs a library, that does the trick =
TProcess.Environment.Text := 'LD_PRELOAD='/the/directory/of/thelibrary.so' 
;   

You may also use this = (it seems bad ;-( =
http://xahlee.info/UnixResource_dir/_/ldpath.html ) =
TProcess.Environment.Text := 'LD_LIBRARY_PATH=/the/path/of/library'

But what if multiple libraries are needed ?
I have try with = 
TProcess.Environment.Text :=
'LD_PRELOAD=/the/directory/of/thelibrary1.so;/the/directory/of/thelibrary2.so' 
; 
But without luck.

Same for LD_LIBRARY_PATH, how to define multiple path ?
=  TProcess.Environment.Text :=
'LD_LIBRARY_PATH=/the/directory1/;/the/directory2/'
Without luck too. ;-(

Many thanks.

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Multipe-path-in-TProcess-Environment-tp5721893.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Multipe path in TProcess.Environment ?

2015-06-21 Thread fredvs
 Ha, ok... (by the way, what character is colon ?) 
= https://en.wikipedia.org/wiki/Colon_%28punctuation%29

= OK.

But =

 So LD_PRELOAD and LD_LIBRARY_PATH are unix only ?
 What about Windows, what should be the TProcess.Environment.Text ?

= not OK.

Thanks.

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Multipe-path-in-TProcess-Environment-tp5721893p5721899.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] loadlibrary() unsafe ?

2015-06-20 Thread fredvs
Re_hello.

Huh, i am loosed...

Here the working script run by TProcess (but that cannot be canceled)=

#!/bin/sh
LIBPORTAUDIO=libportaudio.so  #portaudio library
ESPEAKBIN=espeak #espeak binary
CALLDIR=${0%/*}/# directory where is ESPEAKBIN
export LD_PRELOAD=$CALLDIR$LIBPORTAUDIO
$CALLDIR/$ESPEAKBIN 
___

Now, i try to do the same with TProcess.environment =

 - AProcess.Environment.Text := 'export
LD_PRELOAD=/home/fred/sak/sak/sakit/liblinux64/libportaudio.so'  ;   
= do not work ;-(

 - AProcess.Environment.Text :=
'LD_LIBRARY_PATH=/home/fred/sak/sak/sakit/liblinux64/'  ;   
= do not work too ;-(

Is the way how i use AProcess.Environment ok ?
Maybe i did something wrong while using environment...

Thanks.

Fre;D


 



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/loadlibrary-unsafe-tp5721801p5721866.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] loadlibrary() unsafe ?

2015-06-20 Thread fredvs
@ Giuliano = thanks for advice ;-)

Hum, finally, using =
AProcess.Environment.Text :=
'LD_PRELOAD=/home/fred/sak/sak/sakit/liblinux64/libportaudio_x64.so'  ;  

It works ;-) ( was a  wrong character...)

So, many, many thanks, i get the solution.

Many thanks to everybody.

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/loadlibrary-unsafe-tp5721801p5721869.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] loadlibrary() unsafe ?

2015-06-20 Thread fredvs
@ Ewald = many thanks for your help.

Your advices are very promising...

I will test it and write later the result.

Write you soon.

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/loadlibrary-unsafe-tp5721801p5721865.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] loadlibrary() unsafe ?

2015-06-20 Thread fredvs
Re-re-re-Hello.

This one does not work too ;-( =
- AProcess.Environment.Text :=
'LD_PRELOAD=/home/fred/sak/sak/sakit/liblinux64/libportaudio.so'  ;  

???

Many thanks.

Fre;D




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/loadlibrary-unsafe-tp5721801p5721867.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] fpchmod(thefile, S_IRWXU) not for freeBSD ?

2015-06-25 Thread fredvs
Hello.

This to advice that fpchmod(thefile, S_IRWXU) is not working with freeBSD.
This because some const are missing for FreeBSD in FPC's RTL.

But, thanks to Graeme, this solves the thing =

...
{$IFDEF FREEBSD}
const
  S_IRWXU = S_IRUSR or S_IWUSR or S_IXUSR;
  S_IRWXG = S_IRGRP or S_IWGRP or S_IXGRP;
  S_IRWXO = S_IROTH or S_IWOTH or S_IXOTH;
{$ENDIF}
...
Implementation
...

Fre;D




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/fpchmod-thefile-S-IRWXU-not-for-freeBSD-tp5721913.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Multipe path in TProcess.Environment ?

2015-06-25 Thread fredvs
@ Tomas and Michael.

Sorry for delay... = many thanks for answers.

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Multipe-path-in-TProcess-Environment-tp5721893p5721912.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] loadlibrary() unsafe ?

2015-06-20 Thread fredvs
@ Waldo = thanks for help. ;-)

But TProcess.Environment kills the script...
No script needed anymore ;-)
The script will become a program.ini...

= Works perfectly.
TProcess.Environment.Text := 'LD_PRELOAD='/the/directory/of/thelibrary.so' 
;  

= And now, canclel_speech (= TProcess.terminate) woks perfectly (not with a
script).

Fre;D

PS: Excellent tip to know, many thanks for the gem.




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/loadlibrary-unsafe-tp5721801p5721873.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/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] loadlibrary() unsafe ?

2015-06-11 Thread fredvs
Hello.

Here the thing: a open-source program, eSpeak (voice synthezer) uses 2
libraries: espeak-library and portaudio.

In eSpeak source =

- For the Windows version, the libraries are included in the executable
(static linked).
  To do run the program = it is easy = just run the executable via
TProcess (espeak.exe).

- For Linux, the eSpeak source produces a executable with static
espeak-library included but without static portaudio-library included in
executable.
  So portaudio library must be installed in library path of the system.
  If portaudio is not installed in library path of the system, a trick that
works is:

  To do run the program = 
  - first dynamic load portaudio with
loadlibrary('/the_path_you_want/libportaudio.so').
  - run the executable via TProcess (espeak).

- For freeBSD, the eSpeak source produces a executable without static
espeak-library nor static portaudio-library included in executable.
  So both espeak-library and portaudio-library must be installed in library
path of the system.
  If libraries are not installed in library path of the system, a trick that
works is:

  To do run the program = 
  - first dynamic load portaudio with
loadlibrary('/the_path_you_want/libportaudio.so').
  - then dynamic load libespeak with
loadlibrary('/the_path_you_want/libespeak.so').
  - run the executable via TProcess (speak).

All is working like charms.

Now i heard that this trick is unsafe.

Why ?

Many thanks.

Fre;D




-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/loadlibrary-unsafe-tp5721801.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/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] loadlibrary() unsafe ?

2015-06-12 Thread fredvs
@ Ewald and Mark = thanks for answer. ;-)

Yep, i agree, the process is exotic but works so good.

I have to agree too, following Martin Schreiber way: = export
LD_PRELOAD=$LIBPORTAUDIO, before to run the executable works too.

And is maybe safer.
And do not need dynlibs in uses section.
And no need to unloadlib().

So, in short, use loadlibrary() to pre-load a library works but better not
use it ;-)

Many thanks.

Fre;D







-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/loadlibrary-unsafe-tp5721801p5721822.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/cgi-bin/mailman/listinfo/fpc-pascal


  1   2   3   4   5   6   >