Integrate Julia scripts into NI Labview

Hello, how about everyone, my most sincere and cordial greetings to all who read this post.

I am a fairly new user and amazed at how great it is to use Julia as an alternative to other languages.

My question is a bit silly but I still have no where to start, I would like to generate DLLs of some functions that I generate later in Julia.

I have generated these DLLs before in C # within visual studio but they are really deficient, I would like to know if I can generate them in Julia due to their optimization and ease of programming, in addition to being free software which is what makes it great and amazing.

# Example in Julia
function Sumita(x,y)
    return x+y
end

Relative to NET in C#:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Ejemplo_Operaciones
{
    public class Ej_OperacionesBasicas
    {
        public int Sumitaa(int A, int B)
        {
            int Result = A + B;
            return (Result);
        }
    }
}

My interest is if someone could help me or guide me what would be the process to generate the DLL with Julia 1.4 and what files do I have to generate, configure and more.

Thank you in advance and I wish someone could guide me !! Kind regards to all again.

1 Like

I forgot to mention that this DLL would be used in other virtual instrumentation software called NI Labview, that when correctly generating this dll it would be no problem calling it from this software.

any suggestions please don’t let me die alone :sleepy: :sleepy: :sleepy:

Hi,

The hard truth is that its not possible to compile Julia down to a DLL.
You can use https://github.com/JuliaLang/PackageCompiler.jl to create an executable and call it from LabVIEW (https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P821SAC) or maybe use something like ZeroMQ to communicate between two processes.

Hello, thanks for answering my question, the option of zeromq sounds interesting, I will try, if I do not die trying hehe.

I thought I had read that with build_shared_lib in PackageCompiler 0.64 if they could be generated, but in the current version, 1.1 already creates images, as you mentioned to generate executables, but I think it would be worth it for another thread to learn how to do them and all the corresponding configurations as well as dependencies to libraries etc.

You could do this in Flojoy by writing a Flojoy block in Python that calls a Julia script:

Flojoy is a free (open-source) visual programmer for Python. It comes with out-of-the-box support for the most common DAQ and test & measure brands (NI, Tektronix, Keysight, Rohde & Schwarz, etc). I’m one of the project’s creators and interested in this use case (Julia for hardware control). Please let me know if I can assist with a solution!

@JPulia that sound really interesting.

Could you specify what do you mean? For example - NI USB-TC01, a DAQ for one thermocouple (just what I connected yesterday). What would be necessary to get it into Flojoy?

@Eben60 looks like no one has uploaded a driver for that particular model yet (browsing here: Hardware Overview | Flojoy Docs) :crying_cat_face:

There are blocks for NI’s USB4065 DMM however.

If you know a bit of Python, you could use the Python script for the USB4065 DMM connection block as a template, then modify it with a Python library that interfaces with the USB-TC01 (I suppose nidaqmx?).

Feel free to join Flojoy’s Discord for 1:1 support in getting this to work.

It’s absolutely possible: Libraries · PackageCompiler

1 Like

@JPulia thank you especially for the link to the hardware overview.

USB-TC01 was simply taken as an example - first, because I just dealt with it, second because it is one of the simplest devices - one parameter configurable, one type of measurements, one channel. Now it is a part of a LabVIEW controlled experimental setup.

My question was actually what does “out-of-the-box support” mean? Well, NI sells probably half a thousand DAQs. You currently support one model, so I’d estimate the chance having an available driver for some random model to be below 1%.

Which is actually to be expected: Creating such a driver, especially fully implementing access to all features of a moderately complex DAQ, is quite a lot of work.

This thread is old, I think PackageCompiler was not yet available 3 years ago.

Another thing which happened since then in the context of this thread:

that is implemented in (my) package LabVIEW0

1 Like