Making dll from VI containing labview global variable ?

I've made dll from VI containing labview global variable.
But, when I write a c program calling a function from the dll, it returns just error.
The goal is to read a labview global variables from c program. What can i do for it ?

Hi
If you don't use the dll in your LV app, it will be difficult, because it will be in the adress-range of you c app. So any writing of values to the global variable in LV, won't affect the variable in the dll.
What you can do is some kind of client-server architecture. You need a third app, which just does the data exchange - so you should be able to write a value from LV and read it from c.
There already have been discussions about similar topics - just search the forum.
Thomas
Using LV8.0
Don't be afraid to rate a good answer...

Similar Messages

  • Can LabVIEW global variables be shared between UUT sequence steps in the parallel sequence model?

    Sorry for this simple question,  I'm having a hard time finding this answer.
    If I launch a sequence to run on two UUTs in the parallel sequence module,   can I get both UUTs to run LabVIEW vis that use global variables such that :
    1) UUT 0  executes 20 LabVIEW Vi  steps asynchronously,  5 of which access data from LabVIEW global variables A, B, C (Strings)
    2) UUT 0 executes the same 20 LabVIEW based steps asynchronously  5 of which access data from then same LabVIEW global variables A, B, C (Strings)
    I am a little worried that using file globals may have some delays or more of a race condition than using native LabVIEW global variables like in a single labview application perform.  
    QUESTION 2:  Are file globals actually written to the hard drive and shared between parallel sequences through file transfer?  OR  are they in memory?
    Brad Whaley
    LabVIEW Certified Engineer

    Hi bdwhaley,
    Are your parallel sequences only reading from the global variable? Or are they writing to the variable as well? If it is just reading, then you should be okay. File globals are read from memory. Every time they are read, a copy of the data is made in memory.
    Humphrey H.
    Applications Engineer
    National Instruments

  • How to build labview global variable into dll?And how to use it in vc++ program?

    Hi!
       I want to build labview application into dll and use vc++ to call it.The labview program is a little complex,for it has many interface to vc++ and has while loop in it.When I use vc++ to call it,I must use vc++ to do other things.That is to say,vc++ creates a new thread to provide for the labview dll to run.the vc main thread goes on to other things.But the vc++ main thread must communicate with the labview dll by setting its inputs' parameters and get the results of running labview dll.Can you advise me how to realize it?
       I think global variable of labview could be useful when realizing the communication betweeb vc thread and labview dll.So I want to ask whether the labview global variable could also be built into dll and use it.Could you please tell me how to realize my idea?
       Thank you!

    [email protected] wrote:
    Hi!
    I want to build labview application into dll and use vc++ to call
    it.The labview program is a little complex,for it has many interface to
    vc++ and has while loop in it.When I use vc++ to call it,I must use
    vc++ to do other things.That is to say,vc++ creates a new thread to
    provide for the labview dll to run.the vc main thread goes on to other
    things.But the vc++ main thread must communicate with the labview dll
    by setting its inputs' parameters and get the results of running
    labview dll.Can you advise me how to realize it?
       I
    think global variable of labview could be useful when realizing the
    communication betweeb vc thread and labview dll.So I want to ask
    whether the labview global variable could also be built into dll and
    use it.Could you please tell me how to realize my idea?
       Thank you!
    You
    can't access LabVIEW globals directly from a caller to the LabVIEW DLL.
    However there is no problem in providing specific accessor VI functions
    to that global and export them as additional functions from the DLL.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Labview global variable dll

    Dear Sir
    我的Labview8.5程式中含有global variable,我要做成DLL,給VC使用,請問global variable要如何包進DLL中。
    謝謝
    已解決!
    轉到解決方案。

    Hello wcw1224,
    可以參考下面的連結
    http://forums.ni.com/ni/board/message?board.id=170&requireLogin=False&thread.id=147485
    簡單來說,你在VC下不能直接去存取DLL內的Global Variable
    只有DLL包含的程式可以存取Global V
    你必須撰寫一個程式,來存取你的Global Variable
    然後將這個存取程式也包在DLL當中,這樣VC就可以使用這個函數來存取Global Vairable

  • How to create a dll from vi in Labview 7.0 ?

    Hello,
    I want to create a dll from a vi in Labview 7.0.
    I've found the url: http://zone.ni.com/devzone/conceptd.nsf/webmain/003A3E6A5E9CCCEC8625691F0072B2C5
    explaining how to create DLLs from LabVIEW in Labview 6.0i but this method is not available in my Labview 7.0.
    How is it possible to create a dll from a vi or from vi's (stored in llb-files) ?
    With thanks,
             best regards,
                  Geert

    You can only create DLLs and Standalone Applications if you have LabVIEW professional or higher.
    If you only have LabVIEW Base of Full, you need to purchase the Application builder seperately. 
    (Check under "Deployment tools" in the LabVIEW comparison matrix. What level do you have?)
    Message Edited by altenbach on 10-18-2005 08:45 AM
    LabVIEW Champion . Do more with less code and in less time .

  • Accessing Var from main Nib/Class - [global variables]

    I'm sure this is a simple solution and the problem is I'm just not thinking right. I just started programming in Objective C but have come a long way in the past 2 weeks. Pretty extensive knowledge in C# and some java.
    Anyways, I've been creating an app and have streams working, CFNetwork working, network services discovery working and a tab bar with a custom View controller linking to one of the tab-bar buttons.
    So when you click on one of the tab bar items it opens a new nib file. That nib loads a table view. When nib loads it hits a method which starts looking for network services and updates the table when it finds some.
    Now the idea is is to have a selector on the cell and when you choose the service it adds same variable info, ip and port, back to a global variable which can be used through the entire app and all extra loaded nib files.
    Out of all this, I don't know how to access global variables....prob should be the simplest thing to do out of all I've done. I have ideas of how it should be done but don't know how to access it.
    Idea would be:
    MainWindowNib has NSString var that is public with a getter setter. But how can I access that MainWindowNib var from a SecondView.nib file/class. There a way to get the parent of the secondView.Nib? I have no clue.
    Any help would be great!
    Thanks!

    I'm still a bit confused how you access that method.
    Main.nib class : UIApplication
    NSString *port
    SetupView.nib : NSViewController
    view
    -TableView added to view
    -Seperate NSObject for TableViewDelegates
    -When item selcted, pass NSString to [main port]
    How do I get a pointer to port. I don't really understand how to do this with objective C.
    In C# I would be something like: [Not exact syntax but u get the idea]
    public Main : Form
    public string port{get;set;}
    Main()
    sView SeconddForm = new SecondForm(this);
    public SecondForm : Form
    SecondView(Main main)
    main.Port = "8080";
    Message was edited by: Clarke76
    Message was edited by: Clarke76

  • Concept of Global Container or Global Variable

    Hi friends,
    My Scenario is from JMS to SOAP.
    I need to store some data when it comes to XI from JMS.
    When the response comes back from SOAP I need to add these fields and send back to JMS.
    Can I do this Scenario without using BPM ?
    Is there any concept like Global Container which I can use it in different Message mappings?
    Thanks and regards,
    Jose

    Hi,
    This object enables you to cache the values that you want to read again when you next call any user-defined function in the same message mapping. Note that the sequence in which user-defined functions are called is predefined. It depends on the position of the target fields that the function was assigned to
    On details of global container refer these.
    /people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14
    http://help.sap.com/saphelp_nw2004s/helpdata/en/75/8e0f8f3b0c2e4ea5f8d8f9faa9461a/frameset.htm
    /people/michal.krawczyk2/blog/2005/03/04/globalcontainer--in-graphical-mapping-xi

  • Can labview globals or controls be modified directly from a dll

    Is it possible to obtain a pointer or handle to LabVIEW global variables - specifically clusters of scalars, not including strings or arrays, which presumably would occupy a fixed memory area.
    If this is not possible, can the value of data held in LabVIEW controls be modified from a dll by passing control references to the dll and if so how can this be done?
    Using LabVIEW 6i, Windows NT SP6, MS-VisualC++ 6.0

    I created a dll with LabVIEW 6.0 which had as its only input parameter a control refnum for a string control. I used this refnum to modify the value of the string control. I built the dll and then from a new VI called the dll using a call library function, passed it a refnum to a string control in the calling VI and ran it. The value of the string control in the main VI was change by the dll by only passing it a refnum.
    To do this you must have LabVIEW 6.0 Pro or App builder. (I did all this with LabVIEW 6.0.2 update installed)
    Attachments:
    caller.vi ‏8 KB
    chngstring.dll ‏17 KB

  • Status with global variable

    Hello to you all,
    I would like to add a status bar using a global variable, unfortunately it does not work that way I thought.
    Pls see attachement: Status_test_global.vi contains the global variable that I used.
    What couses the problem and how can I solve it ?
    Every answer is appreciated.
    Br
    B.
    PS: Status_global.picture is a *.jpeg
    Solved!
    Go to Solution.
    Attachments:
    Statusbar_Test_global.vi ‏4 KB
    Status_bar.vi ‏10 KB
    status_global.jpg ‏223 KB

    There are some mistakes in your VI.
    1) You have not followed dataflow structure between updating global variable and delay time.
    2) You are not updating indicator (You have kept it outside loop hence it will update only one time)
    Do following correction
    1) Make functional global VI. (Take reference from forum if you don't know about functional global)
    2) make two while loop structure running parallel.
    3) From one loop update message in Functional global vi.( Keep sequence like -messageupdate-delay-messageupdate-delay..so on)
    4) Read functional global vi in another loop also keep some delay in this loop.
    Try this correction.
    Prashant
    CLAD
    Labview 6.1-2010
    KUDOS ARE WELCOMED
    PBP (CLAD)
    Labview 6.1 - 2014
    KUDOS ARE WELCOMED.
    If your problem get solved then mark as solution.

  • Programmatically select global variable object

    Hello all.
    I have a rookie question that may have an easy answer (or perhaps you can direct me to a different method which is fine too).  I’m using a global variable in an instance where it’s controlled by a parent VI and read by multiple children VIs.  The global variable contains Boolean switches, each with a specific name.  
    If possible, I’d like to make the ‘child VI’ more generic and programmatically flexible so that I don’t have unique children.  That way, instead of four children, I just have one (makes debugging easier).  Here’s the crux of my question:  selecting which object is assigned to the global variable on the block diagram is done by clicking on it with the mouse – can I instead do that programmatically?
    More specifically, when using the global in children VIs (as instructed in the “Creating Global Variables” section of the help files), you can select the global vi and add it to your block diagram.  The next step is to select the front panel object to associate the placed variable with the proper data (you do this by mouse clicking the node you just created – see the attached image).  My question is, can I select the object associated with the placed node programmatically instead of needing to mouse click on it?
    Cheers!
    Attachments:
    ForumEX files.zip ‏31 KB

    Steve Chandler wrote:
    There is a better way of doing this as the others have already pointed out.
    Even Single Process Shared Variables with their API Interface would be better as Globals:
    Using this VI to read the variables gives you the ability to reference them with a string (Link to Variable). You may have to add an additional variable in future versions of your code, where you just need to add the new variable to the project and pass the string to the VI without changing the code. Single Process Shared Variables are based on Global Variables, which are usually just a bit faster. Single Process Variables can easily be converted to network variables.
    However, I agree with Damien that Data Value References would probably be the best sulution.
    Btw, there is a good KB talking about Globals: Are LabVIEW Global Variables good or bad, and when is it ok to use them?
    Christian

  • Calling LV DLL from VB

    I have a vi that initializes, measures, and releases
    an OSA instrument. I want to call this routine from VB.
    I used Standard calling convention when making DLL from LV.
    Here is my VB declaration:
    Private Declare Sub OSAMeasurement Lib "C:\ADE\OSAMeasurement.dll" Alias "OSADFBMeasurement" _
    (ByVal GPIB As Long, _
    ByVal Serial_Number As String, _
    ByVal FileName As String, _
    ByVal File_Path As String, _
    ByVal Start_Wavelength_nm As Double, _
    ByVal Stop_Wavelength_nm As Double, _
    ByVal Level_Scale_dB As Double, _
    ByVal Res_nm As Double, _
    ByVal Peak_Wavelength As Double, _
    ByVal Peak_Level As Double, _
    ByVal SMSR As Double, _
    ByVal FWHM As Double, _
    ByVal Mode_Offset As Double, _
    ByRef Level_Array() As Double, _
    ByRef Wa
    velength_Array() As Double, _
    ByVal Array_Length As Long)
    Here is my VB call:
    Call OSAMeasurement(Form1.OSA.PrimaryAddress, _
    (strOXM & Form1!txtOPMNumber), _
    (CStr(CInt(dblSetVoltage)) & "v_Scan.txt"), _
    (txtDataStoragePath & strOXM & " " & Form1!txtOPMNumber & "\"), _
    1520, 1620, 5, 1, Peak_Wavelength, Peak_Level, _
    SMSR, FWHM, Mode_Offset, _
    Level_Array, Wavelength_Array, 1001)
    I get RunTime Error "49"
    Bad DLL calling convention
    What is wrong?
    Any suggestions/comments?
    Attachments:
    OSA.zip ‏703 KB

    Basically what i want to do is to call the microchip's dll called "mpusbapi.dll" from VB6. This dll is written in C++. This dll has some basic functions of usb like MPUSBRead() , MPUSBWrite , MPUSBOpen() etc.
    I have made a usb data acquisition card and i want to communicate with this card by means of VB 6. Please tell me or send a tutorial of calling a DLL from VB 6.
    Any help greatly appreciated
    Attachments:
    _mpusbapi.cpp ‏42 KB
    _mpusbapi.h ‏19 KB

  • Call function in LabView from a DLL, then access global variable from DLL

    I have created a DLL in LabWindows with a function and a structure.  I want to call the function from within LabView and then access the global structure.  I am able to call the function from the DLL with a "Call Library Function Node" and can access the return value, but I cannot figure out how to access the global structure.  The structure is declared in the DLL header file with __declspec(dllimport) struct parameters.
    Is there any way of accessing this structure without using the Network Variable Library?
    Solved!
    Go to Solution.

    dblok wrote:
    When you say "access to" or "the address of" the global variable, do you mean to pass the variable as an argument to the function call in the DLL?  If so, then I was not really sure how to pass a cluster from LabView by using the "Call Library Function Node".
    Yes, that's exactly right.  I would include a pair of helper functions in the DLL to read and write the global variable.  Alternatively you might write separate helper functions for each field inside the global structure, depending on the number of fields and whether you want to do any validation on the values.
    You can pass a cluster by reference to a function that expects a struct by setting the parameter to Adapt to Type, so long as the cluster does not contain any variable-length elements (strings or arrays).  The cluster needs to match the struct exactly, and sometimes that involves adding extra padding bytes to make the alignment work.  Variable-length elements in LabVIEW need to be converted to clusters containing the same number of elements as the struct definition (for example, if your struct contains char name[12], you would create a cluster of 8 U8 values, and you could use String to Array of Bytes followed by Array to Cluster to convert a LabVIEW string into that format).  If the struct contains pointers it gets more complicated, and it may be easier to write functions in the DLL to access those specific elements individually.
    If you can't get this working or need help, post your code and an explanation of the error or problem you're seeing.
    EDIT: it is also possible to include a single function in the DLL that returns the address of the global variable, which LabVIEW can then use to access and modify the data, but that's more complicated and likely to lead to crashes if you don't get the memory addressing exactly right.

  • How can I handle global variables from different DLLs created based on VIs that access those variables

    My goal is to break apart an entirely LabView created application so I can still use parts of it (builded as Shared DLLs upon on some VIs) in my new .Net application. My problem is that some others VIs (that I am not intending using) are changing those global variables (in the natural data flow of the application).  I could , of course, send the values of those global variables as parameters, but I don't know how should I pass those data types (and their size)... There are some clusters there...
    Any help is well appreciated

    vulpe wrote:
    My goal is to break apart an
    entirely LabView created application so I can still use parts of it
    (builded as Shared DLLs upon on some VIs) in my new .Net application.
    My problem is that some others VIs (that I am not intending using) are
    changing those global variables (in the natural data flow of the
    application).  I could , of course, send the values of those
    global variables as parameters, but I don't know how should I pass
    those data types (and their size)... There are some clusters there...
    Any help is well appreciated
    Your
    problem is of course the use of globals. That is almost always a bad
    idea and asking for troubles once your application gets bigger.
    Avoiding race conditions and undesired influences between different
    parts of your application will take up more and more of your
    development time as your project grows.
    You should look into Functional Globals (LV2 style globals) and shift
    registers for data storage and queues for passing information between
    different parts of your applciation. Using these techniques
    consequently, will require you to spend some more time initially but
    will allow you to grow your application without increasing the
    complexity of managing such things exponentially.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Why does Labview create a .vi for each global variables?

    Hello,
    I wrote an Labview application which use several global variables (almost 30 variables). All the variables are of variable type "single process". For each of these variables, Labview creates a vi.
    For example, for the variable "_TS.Measures.channes", Labview creates a vi named "TS_'_TS.Measures.channels'.vi". Which means, I have almost 30 "name of variable".vi files: this is confusing!
    All my VI are inside library (.llb). When I try to put the VI of a global variable in a library, Labview can't find them anymore.
    May be can somebody explain me, why LabVIEW does create these VI and how is it possible to put them in a library.
    Cheers,
    Risotto

    Hi everybody,
    Thank you for your answers, I get a lot of informations.
    Yes, I use the new shared variables in LabVIEW8, which I am using like sort of global constants. Now I am understanding what guys are telling me all this about global variables in LabVIEW7.1. Sorry, I forgot to say I was using LabvVIEW8.
    I will have a look on the tutorial too.
    But yet one point about the library collecting all the shared variables in the windows explorer and in the project explorer: When I create a shared variable in my LabVIEW project - for example "test1" as double/single process - the variable doesn't appear in my file directory, but it appears in the project explorer in a library (.lvlib).
    When I drag/paste my shared variable on the block diagramm of my VI, then a file "Math_test1.vi" appears in my file directory. There is no extra .llb created to contain my shared variable vi.
    If I drag/paste the file "Math_test1.vi" in the Math.llb (see picture), then the file is moved in the llb and disapeared from the directory.
    If I created another shared variable "test2" as double/single process and put it on the VI, then LabVIEW creates2 files in the directory: "Math_test1.vi" and "Math_test2.vi". So that I get 2 vi for the "test1" variable now (one in the llb and one in the directory).
    I use several library in the project explorer. But the  library in the project explorer seems to create file with other extension (.lvlib) than the sdtandard LabVIEW library (.llb).
    Cheers,
    Risotto
    Attachments:
    picture.jpg ‏223 KB

  • Problem with .DLL and global variables

    Hi,
    I need some helps to figure out my problem.
    I wrote a .dll file to open and run a GUI. When I run it at the first time, it is ok. When I call it again, there is an error "Pointer to free memory passed to library. It will be ok if I completely exit the program that calls the .dll before re-call it. I think there is some problems with global variables when I call another thread. How can I free global variables between threads. Is there any solution for this problem?
    Thanks

    Vinh Pham:
    Are you doing anything intentionally that frees your globals?
    CVI ships with an example program that demonstrates calling a DLL to create a user interface: guidll.cws.
    I made two simple modifications to guidll.cws.
    1. In guidll.c, I made hpanel global by moving its declaration from RunDLLUI() to right below the #include statements.
    2. In useguidll.c, I duplicated the lines calling RunDLLUI () and MessagePopup() to call the DLL gui twice.
    I built the project and ran it.  I had no problems with free'ed globals.
    Take a look at the guidll example.
    Can you either post your code or a modification to guidll that demonstrates the problem you're having?

Maybe you are looking for

  • How to use two ipads with icloud on one computer

    Can you use two iPads on one computer with  iCloud so that they are still separate?

  • Identified Bug in GRC AC SP 12

    Dear Experts, My client configuration : SAP GRC AC SP 12 When I run the User Sync job there are no violations seen in the Management Report. I have checked the log and it shows that the users are being pulled from the backend system but they are not

  • FCP5 removes last frame from any 23.98fps movie

    I'm having an issue with 23.98fps Quicktimes in FCP. When I play the clip in Quicktime, the frame count is correct. When the same movie is opened in the FCP viewer or dropped in a bin, FCP removes the last frame. For example, say I have 2 clips, iden

  • Hyperlink Link to Email

    The iWeb hyperlink email solution allows you to configure the reciepent and the subject however it does not appear to support default text which would appear in the body of the email. Is there an iWeb solution for this?  Ant..

  • Send email notification from outside of OIM

    Hi, I have a code which i am running out of OIM. The code does the following things: 1. Updates user's end date of the basis of end date given as input. 2. Send email notification once user's end date is updated. I am able execute point 1 successfull