QB64 Phoenix Edition
Inputting output from other languages - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: Inputting output from other languages (/showthread.php?tid=3710)



Inputting output from other languages - Helium5793 - 05-26-2025

Hi,
I have several programs that call python programs, the python program writes its results to disk and then the basic reads the results and uses them.  (some of the python libraries are very useful). In particular I am using pyephem, a library that calculates astronomical date on stars and planets.  
Is there a way to do this without the intermediate step of writing the information to disk?  Can the output of an external program be ported directly into a basic array or other structure?
John


RE: Inputting output from other languages - TempodiBasic - 05-26-2025

Hi John
Ready here you can declare external library and communicate with them using the right kind of data.
https://qb64phoenix.com/qb64wiki/index.php/Libraries


RE: Inputting output from other languages - Jack - 05-26-2025

pyephem wraps the C library libastro, why not compile that as a dynamic library and use that from QB64?
if you are on Linux then the library may already be available through the package manager


RE: Inputting output from other languages - Jack - 05-27-2025

how about a Shared memory mapped file ?


RE: Inputting output from other languages - Helium5793 - 05-27-2025

I would love to do this if I knew how (compile as a dynamic library and use that).  I have not been successful in my rather feeble attempts to do that. Was not sure it was possible, so failure is an option.    I am on linux (choice of debian or fedora, I use both).   If you can suggest how to include libastro and access it from qb, that would be a godsend.

John


RE: Inputting output from other languages - Jack - 05-27-2025

Helium5793
I am on Windows with msys2 as one of my tools, I built libastro without problems, was also able to translate astro.h to FreeBasic thanks to fbfrog by DKL
the translated header could be a starting point to port to QB64, but I have zero knowledge on using libastro.


RE: Inputting output from other languages - Jack - 05-27-2025

why not use pipe to pipe the output to QB64 ?
I don't know how but someone familiar with piping on Linux could possibly help


RE: Inputting output from other languages - TempodiBasic - 05-28-2025

#5... you can use also external library compiled, not only DLL
read better wiki..using external C library
and TADA a google research show me this libastro by Corto Maltese  libastro in C on Gitub

Well looking at wiki you can recognize how to declare Type of data in QB64pe to exchange with external C library, and the examples show how code this interfacing with external C libraries.

Good luck for your goal


RE: Inputting output from other languages - Helium5793 - 05-30-2025

Looks like I got my work cut out for me.  Thanks for the tips everybody.  I have some learning to do!
John