Other tran transpiling to JS, does google dart compile to object code? - dart

Google dart compiles to javascript code but dart is also a standalone language. I know Dart can also run without javascript (on the vm), but to what does it compile to? Does it compile to C or object code? I couldnt find any information about it.
Im also asking because dart works on mobile devices and ive also read it will be used in some experimental OS called fuchsia.

As far as I know
it's compiled to binary code on-the-fly in the VM,
it's compiled to binary code ahead of time with AoT.

Related

Add TTS functionality to Dart console app

can I get some pointers on how to add Text To Speech functionality to a console/CLI app. I have tried packages for Flutter but I get this error 'Error: Not found: 'dart:ui'. I am assuming they expect a user interface.
I am pretty much a novice, would be glad answers do not assume too much on my side. Thanks!
Yes, Flutter is all about UI whereas a command line app has no UI.
They dont have anything to do with eachother except that Dart is the language used by Flutter.
Flutter tts plugins depend on the specific tts implementation embedded in the OS that the plugin will be running on — Android / IOS, etc.
A Dart command line tool runs in a VM and is OS-independent.
So, as far as I know, it is impossible to import a Flutter plugin into a Dart command line app and then compile it.
The only way I can see to get tts functionality in a Dart command line tool is to use a web based (OS-independent) tts service such as the Google text to speech API.

How to get autocompletion for custom modules in Lua

Whatever the setup I use for coding in Lua is always the same thing: autocompletion works for the standard libraries but not for the 3rd parties or my own libraries.
I tried ZeroBrane studio, VSCode with Lua plugin and Vim with lua ftplugin, exact same behaviour in all 3. I start typing a standard library symbol such as
io.w
And I do get the autocompletion popup showing everything in the io module, and showing the closest method to io.w which would be io.write, with the signature and documentation.
Now I try a 3rd party or my own library such as
require("wx"); wx.
or
require("my_module"); my_module.
Either nothing happens at all, or I get a warning "undefined" on the module name.
If I run the code with the interpreter, it does work. It will call the function in the module just fine. But in the editor, warning and no autocompletion.
Am I missing something?
wxwidgets API comes prepackaged with ZeroBrane Studio, but it needs to be explicitly enabled (you can add api = {"wxwidgets"} to the config file to do that; see Custom APIs section in the documentation). Any other (non-packaged) API would need to be added to the IDE as documented here. There are several popular APIs already provided as plugins; for example, for Redis, Urho3d, openRA and others.

How Does Dart AOT Work?

In my search for how Dart AOT works, I have not found many resources except this video. I would like to know how it is that code can be compiled down to native machine code, such as Android or iOS, when there exists different pieces of hardware that code needs to run on.
From what I understand, there are only descriptions of apps produced in Flutter. That description (written in Dart) is then compiled down to native machine code, but how? A program written in Swift is different from a program written in Kotlin.
A compiler creates the binary code from Dart source code.
For mobile applications the source code is compiled for multiple processors ARM, ARM64, x64 and for both platforms - Android and iOS. This means there are multiple resulting binary files for each supported processor and platform combination.
From what I understand, there are only descriptions of apps produced in Flutter.
Not sure what you mean by that. The concept of source code and compilation to a target platform is basically the same for each programming language.
JIT (Just in Time) compiles at runtime on-the-fly while AOT (Ahead of Time) compiles before the application is deployed and launched.
A program written in Swift is different from a program written in Kotlin.
Also not sure what you mean by that.
Swift can compile to native code and Java to Java bytecode. Swift is AoT while Java is JiT. The end result is always binary code for the target platform and CPU.

Difficulties including c++ libraries in objective-c++ app

I'm having this annoying problem.
I'm doing an ios app in objective-c++. I'm coding the backbone of the app in c++ and the UI in objective-c, because the app is most likely going to be ported to Android (maybe also wp) at a later point. The setup works just fine... That is, until I want to include some c/c++ libraries.
The app is going to do a lot of requests to web services and therefore I've decided to include the libcurl library.
I have downloaded the library, configured it and "made" it and it is installing just fine in /usr/local/lib and /usr/local/include. I have added the libcurl.a/libcurl.dylib to the project, but here comes the problem:
When I want to include it in the .h or .cpp (or .mm) file it says that the file is missing fx.
#include "curl/curl.hpp" // -or similar according to library, always returns "file not found"
The intellisense is also not suggesting the files/libraries when typing. I have also tried with the libcurlpp and Poco libraries which all installs just fine and are added to the project just fine (via Build phases -> Link Binaries with Libraries), but is not recognized in the code.
I have also build libcurl specific for ios via this link:
http://home.comcast.net/~seiryu/libcurl-ios.html
and again everything is working regarding building and installing the library, but again I can't include it in the code...
I really hope it's just because I'm retarded at this and that it is some sort of setting I have missed or don't know about. Searched all over the web now and tried different solutions, all with the same result. I must be including the libraries wrong in some way...?
P.S. I've also tried adding the OS provided libcurl.4.dylib, with same result. Can't include it in the code.

AIX dynamic linking

I'm working on porting a library onto AIX. It works on Solaris, Windows and Linux but AIX is giving me headaches. I'm at a point where it builds and runs but I have an issue with some of the libraries it's linking in. Ideally I want to be able to ship a library that just requires the c runtime to be available with no other dependencies. At the moment I'm having a problem with libpthread which I can see is a symlink to an AIX specific threading library.
My issue is this:
If I don't link pthread (I don't seem to need to on Solaris for the same code base) then I get undefined symbols. That's fine I am using pthreads. If I link it in then it works fine, except that any calling application also has to link to pthreads. I don't really understand is why does my calling app, which has no dependency on pthread, need to link against it just because it's calling a library which links to the shared object?
I'm on AIX 6.1 using gcc 4.2.4.
I'd be OK with shipping a library that requires pthreads to be present on the library path (ideally we'd get a static version) but I'm a bit unhappy about shipping a library that places linker rqeuirements on the client.
Any ideas on what I might be doing wrong?
I defeinitely seem to be going in circles. I removed the -shared flag on the linker to resolve an earlier problem and that, of course, makes the library static. So the behaviour is just normal behaviour in that if you depend on a dynamic library from a static one you have to link both into your app. So I've put the shared flag back and now half of my functions are no longer accessible. It does explain the problem I was seeing though.

Resources