Screenshot of app status

For general discussion related FlowStone
MichaelBenjamin
Posts: 275
Joined: Tue Jul 13, 2010 1:32 pm

Re: Screenshot of app status

Post by MichaelBenjamin »

.
Last edited by MichaelBenjamin on Mon Sep 21, 2020 10:57 am, edited 1 time in total.
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: Screenshot of app status

Post by trogluddite »

MichaelBenjamin wrote:does that mean that that you can link to external dlls as long as they only use the win32 api

Yes, but there's a caveat! The Ruby library for it (Win32API) only works within FlowStone or within exported exe's - but not in VST plugins (a compromise so that the Ruby interpreter is available without requiring an external file). The library also has a reputation for being very tricky to use (you have use Strings as containers for binary data - e.g. Structs - and so on). Having made a few simple things with it myself, I certainly wouldn't recommend it to beginners of either Ruby or FlowStone.

MichaelBenjamin wrote:so you can compile a gem in c using vs and link that like a dll?

In principle, yes, a Ruby "C-extension" compiled in Virtual Studio can define new Ruby methods which wrap functions of other DLLs and wrap their arguments/returns in Ruby objects. The C++ API for bulding extensions is open-source, AFAIK. IIRC, somebody did once re-compile the Ruby "standard libraries" with VS, but it was a long time ago and I couldn't find the thread when I tried searching.

Doing it this way might not suit every application, though - the DLL primitive and FlowStone API might be better in some cases, to avoid an extra step of going via Ruby and its "object oriented" overheads.

(FYI: I may split this conversation to its own thread if you want to continue, as we're both getting quite a way off the topic of screenshots!)
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
MichaelBenjamin
Posts: 275
Joined: Tue Jul 13, 2010 1:32 pm

Re: Screenshot of app status

Post by MichaelBenjamin »

.
Last edited by MichaelBenjamin on Mon Sep 21, 2020 10:57 am, edited 1 time in total.
MichaelBenjamin
Posts: 275
Joined: Tue Jul 13, 2010 1:32 pm

Re: Screenshot of app status

Post by MichaelBenjamin »

.
Last edited by MichaelBenjamin on Mon Sep 21, 2020 10:57 am, edited 1 time in total.
User avatar
MicheleANE
Posts: 8
Joined: Tue Aug 18, 2020 5:15 am

Re: Screenshot of app status

Post by MicheleANE »

On the extensions subject:
I tried using CSV ruby library (took it from ruby 1.8 installation because the newer ones are not pure ruby) putting the rb file inside the library folder of FS. Now I can use require inside a ruby component to use its functions and it works well also in focus mode. Though, when I tried making an exe of the app, it seems it doesn't work anymore.
Is there some setting I have to change to include it in the exe? Or is there some other step I have to take?
Best regards
Michele
Michele
---Programming to promote laziness---
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Screenshot of app status

Post by tulamide »

MicheleANE wrote:On the extensions subject:
I tried using CSV ruby library (took it from ruby 1.8 installation because the newer ones are not pure ruby) putting the rb file inside the library folder of FS. Now I can use require inside a ruby component to use its functions and it works well also in focus mode. Though, when I tried making an exe of the app, it seems it doesn't work anymore.
Is there some setting I have to change to include it in the exe? Or is there some other step I have to take?
Best regards
Michele

Yes, there are some other steps to take. But first, for all things related to Ruby I highly recommend to refer to chapter 8 of the Flowstone User Guide. You will need it often, so download the guide and have it open, whenever you program in Ruby.
The steps to take are described in chapter 8, page 231. Here the most important part:
If you decide to export your creation and it uses a gem then you need to distribute the gem alongside it. You must also make sure that the paths to the gem are all taken care of or it won't load.
To assure that, the best practice is to create a folder on the same layer as your executable/fsm, and place the content of the gem inside. Then reference this folder when using "require", for example

Code: Select all

require_relative 'gem_content_folder/gem_file'
It may be possible to use require even for relative paths, by preceding "./", but I never used that functionality.

Code: Select all

require './gem_content_folder/gem_file
"There lies the dog buried" (German saying translated literally)
User avatar
MicheleANE
Posts: 8
Joined: Tue Aug 18, 2020 5:15 am

Re: Screenshot of app status

Post by MicheleANE »

Thank you so much Tulamide, you are my new hero.
I tried with the require_relative way but it gave me "can't infer path" error, so I create a new folder in c:/ and placed the gem there, then I used require 'c://fsgems/csv.rb' and it worked well also in the exe run.

Best regards
Michele
---Programming to promote laziness---
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Screenshot of app status

Post by tulamide »

MicheleANE wrote:Thank you so much Tulamide, you are my new hero.
I tried with the require_relative way but it gave me "can't infer path" error, so I create a new folder in c:/ and placed the gem there, then I used require 'c://fsgems/csv.rb' and it worked well also in the exe run.

Best regards

Well done! Yes, an absolute path (full path) will always work with require. If you share your executable, make sure the others also have the gem at the same location. (That last bit was why I tried to install a relative path)
Great to have helped!
"There lies the dog buried" (German saying translated literally)
MichaelBenjamin
Posts: 275
Joined: Tue Jul 13, 2010 1:32 pm

Re: Screenshot of app status

Post by MichaelBenjamin »

.
Last edited by MichaelBenjamin on Mon Sep 21, 2020 10:57 am, edited 1 time in total.
User avatar
MicheleANE
Posts: 8
Joined: Tue Aug 18, 2020 5:15 am

Re: Screenshot of app status

Post by MicheleANE »

I also read the same exact post about require and require_relative. I tried some combinations with both but it keeps telling me that it cannot infer base path or there is no such file to load.
Only way it worked is with the absolute path and require.
I will keep trying and report something when I reach a solution.
Best regards
Michele
---Programming to promote laziness---
Post Reply