FPCJVM Android and libbass.so calling issue

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

FPCJVM Android and libbass.so calling issue

Mgr. Janusz Chmiel
Dear specialists,
Please does somebody of you know, why is it impossible to call
libbass.so in JVM Android mode if external command is being used for
this task?
Because I Am getting run-time error:
error
Failed resolution of libbass.so
OK
I have analysed bass.pas unit and I have found that The following
command is being used to call functions and procedures from this .so
library.
Here is AN example from bass.pas

function BASS_SetConfig(option, value: DWORD): BOOL; {$IFDEF
MSWINDOWS}stdcall{$ELSE}cdecl{$ENDIF}; external bassdll;

So do I have to replace external command by The command
JLSystem.loadLibrary('libbass.so');
But when I have done this, compiler have informed Me about other errors
and compilation aborted with fatal warning.

bass.pas(725,101) Warning: Calling convention directive ignored: "StdCall"
bass.pas(733,102) Warning: Calling convention directive ignored: "StdCall"
bass.pas(745,126) Warning: Calling convention directive ignored: "StdCall"
bass.pas(757,121) Warning: Calling convention directive ignored: "StdCall"
bass.pas(780,79) Warning: Calling convention directive ignored: "StdCall"
Fatal: Compilation aborted

Bass.pas unit which I try to use in JVM mode and Android emeulation is here.

https://github.com/r1me/LAMWBassStreamPlayback/blob/master/jni/bass.pas

It is really interesting developers adventure. Because originally The
unit have been created for FPC ARMHF or other similar target and
cthreads unit is being used by The app, which calls bass.pas unit. So
The question is, if I have chance to call libbass.so in JVM mode or if I
can only dream about it?
Thank you very much for yours help. Libbass.so have been developed by
using SSL to play live streams so it do not allocate too much of RAM, it
can play live streams 24 hours A day without crashes and author deeply
know C language and he is constantly hardly work on this library. So its
quality is better and better.
It is even possible to use this library for making sound games for
visually impaired, because it can load many short sounds without delay
and distortion.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FPCJVM Android and libbass.so calling issue

Mgr. Janusz Chmiel
I have decided to join my second question to this thread, because it is
also related to problem with libbass.so

PPCJVM have problem to compile The following line of code from bass.pas
Delphi unit and also from newest bass.pas which is The part of bass zip
archive for Windows.

   STREAMPROC_PUSH = Pointer(-1);   // push stream
Is it possible to construct this short code so it will have The same
purpose and will be compatible with JVMAndroid compilation mode?
And I Am very sorry, that I AM sending so much messages, but yours
community is so friendly and debates which are here are taking here are
correct and kind.
I do not have somebody near Me, who would have deep Free Pascal
knowledge. So thank you very much for yours patience with Me.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FPCJVM Android and libbass.so calling issue

Jonas Maebe-3
On 17/04/2019 20:11, Mgr. Janusz Chmiel wrote:

> I have decided to join my second question to this thread, because it is
> also related to problem with libbass.so
>
> PPCJVM have problem to compile The following line of code from bass.pas
> Delphi unit and also from newest bass.pas which is The part of bass zip
> archive for Windows.
>
>    STREAMPROC_PUSH = Pointer(-1);   // push stream
> Is it possible to construct this short code so it will have The same
> purpose and will be compatible with JVMAndroid compilation mode?

Calling native code from Java needs to happen through JNI (Java Native
Interface). I have no experience with it, but it will never be possible
to just take an existing Pascal interface to a library and compile that
for the JVM target. Even if it would compile, the result could never work.

Additionally, JLSystem.loadLibrary expects the library name without the
'.so' extension.


Jonas
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: FPCJVM Android and libbass.so calling issue

Mgr. Janusz Chmiel
Thank you very much for yours professional advices.
So really, if I want to call native .so libraryes, I have to use Lamw or
Pandroid.
Lamw uses JNI  interface perfectly. And t is only sad for Me, that it is
not easily possible to create stdcontrols.pas unit, which would be
compatible with this project so I could create some simple GUI with no
need to specify object position numbers.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal