* * *

Author Topic: Anybody tried to use Lazarus to build GUI apps for Go / Golang?  (Read 6042 times)

saml

  • New member
  • *
  • Posts: 20
  • Developer, Biotech Engineer, PhD Student
    • Bionics IT
Hi,

Lazarus seems to be the optimal open source way of developing native GUI apps for the three major platforms: Linux, Windows and Mac. At the same time, Google's programming language Go makes it very easy to write multi-threaded efficient applications (My own little survey shows it is typicall faster than FPC ), and also seems to have quite a growing ecosystem of libraries and tools around it.

So, I was wondering if anybody has tried to write a GUI application that runs Go for the application logic, and FPC / Lazarus for the frontend GUI logic?

If not, do you think it would work, or do you have any hints at where to start in case I get the time to try this out myself (which I hope)?

Blaazen

  • Hero Member
  • *****
  • Posts: 2393
  • POKE 54296,15
    • Eye-Candy Controls
Re: Anybody tried to use Lazarus to build GUI apps for Go / Golang?
« Reply #1 on: June 20, 2014, 04:48:41 pm »
Quote
I was wondering if anybody has tried to write a GUI application that runs Go for the application logic, and FPC / Lazarus for the frontend GUI logic?
If Go language is capable to create libraries (*.dll, *.so) in compatible way then you can link them and use them. It's the same with libraries written in C.
Lazarus 1.9.0 r55743 FPC 3.0.2 x86_64-linux-qt Chakra, Qt 4.8.7, Plasma 5.9.4
Lazarus 1.6.4 r54278 FPC 3.0.2 i386-win32-win32/win64 Wine 2.4

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

hinst

  • Sr. Member
  • ****
  • Posts: 303
Re: Anybody tried to use Lazarus to build GUI apps for Go / Golang?
« Reply #2 on: June 20, 2014, 05:44:52 pm »
C++ & FPC interopability is easy because both are kind of unmanaged and one can load functions from dlls and call them just like that
C++ & Go interopability as well as FPC & Go interopability is on the contrary complicated as **** and I could not even find any article explaining how to do this while searching Google
Maybe it's not that complicated, but I could not find any sensible information. I searched because I wanted it too. The only sort of articles I could find were suggesting usage of some sort of utility "swig" for Go or whatever was its name, in this case one can write // #include someSource.h in .go source and then call C functions. How exactly it works is unclear.

I wanted to know how to call C++ function from dll directly.
I know how to call C++ function from Pascal; I know how to call Pascal function from C++; but I could not find out how to call C++ function from Go
Too late to escape fate

saml

  • New member
  • *
  • Posts: 20
  • Developer, Biotech Engineer, PhD Student
    • Bionics IT
Re: Anybody tried to use Lazarus to build GUI apps for Go / Golang?
« Reply #3 on: June 21, 2014, 12:59:19 pm »
Thanks all for the hints and pointers! Cheers

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 5826
Re: Anybody tried to use Lazarus to build GUI apps for Go / Golang?
« Reply #4 on: June 23, 2014, 09:30:47 pm »
And a settextbuf call to the reading of that fasta file. FPC traditionally has small default filebuffers for text I/O, which is bad for benchmarking.

( http://www.freepascal.org/docs-html/rtl/system/settextbuf.html )

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1826
Re: Anybody tried to use Lazarus to build GUI apps for Go / Golang?
« Reply #5 on: June 23, 2014, 10:06:49 pm »
(My own little survey shows it is typicall faster than FPC )
Oh snap on Mischi's example.
Does it actually produce correct results?
Code: [Select]
  Readln(FastaFile, CurrentLine);
  for i := 0 to length(CurrentLine) - 1 do
  begin
    c := CurrentLine[i];
instead of
Code: [Select]
  Readln(FastaFile, CurrentLine);
  for i := 1 to length(CurrentLine) do
  begin
    c :=CurrentLine[i]
?
...
ah I guess it's coming from Samuel's
« Last Edit: June 23, 2014, 10:09:26 pm by skalogryz »

saml

  • New member
  • *
  • Posts: 20
  • Developer, Biotech Engineer, PhD Student
    • Bionics IT
Re: Anybody tried to use Lazarus to build GUI apps for Go / Golang?
« Reply #6 on: March 09, 2017, 07:41:11 pm »
Quote
I was wondering if anybody has tried to write a GUI application that runs Go for the application logic, and FPC / Lazarus for the frontend GUI logic?
If Go language is capable to create libraries (*.dll, *.so) in compatible way then you can link them and use them. It's the same with libraries written in C.

And ... now it is possible! Since Go 1.5 in fact, and we're already on Go 1.8. This post outlines some of this: https://dev.to/vladimirvivien/calling-go-functions-from-other-languages

So now, let's just see who will be the first to try this out!  :) (I would today if I had more time ...)

arran4

  • Newbie
  • Posts: 1
Re: Anybody tried to use Lazarus to build GUI apps for Go / Golang?
« Reply #7 on: June 08, 2017, 02:50:41 am »
I have already done this and I am doing it for UI dev.. Going by CGO isn't that great though.. I feel there are structures and language compatibilities which could be extended by explicitly working together..

Thaddy

  • Hero Member
  • *****
  • Posts: 4651
Re: Anybody tried to use Lazarus to build GUI apps for Go / Golang?
« Reply #8 on: June 08, 2017, 08:22:38 am »
My openvg example code for the Raspberry Pi interfaces with a shared library written in Go.
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus