Importing shared variable (DLL) with simple function

So I'm attempting to use a DLL I was givven to do something simple.
string input--> DLL --> three string output.
The .h file defines the function like so:
struct FunctionName {
char str1[5];
char str2[4];
char str3[2];
It sems that the wizard is having an issue creating the datatype defined as the struct (which consists of three strings of length (5, 4, and 2).  I've read that sometimes you can go thru the wizard again and create a ctl, but when I did this the function wrapper vi dissapeared form the library it creates...
I'm by no means a C programmer, and dont really remember much of it from school at all.
I'm looking into this here: https://decibel.ni.com/content/docs/DOC-9080  thinking the answer might lie somewhere in the "adapt to type" selection (but this only seems available on the functions input?
Thanks for any advice/suggestions
-pat

You've only shown the definition of a structure, not of a function. Can you provide the prototype for the function that uses that structure? Does the function expect three separate strings as parameters, or a struct containing three character arrays?
If the function expects a struct containing three character arrays, each of fixed length, and the parameter is passed by pointer (this would be normal), then yes, you want to configure the parameter as Adapt to Type. You should create a cluster containing three elements, each of which is itself a cluster. The first of those clusters should contain 5 U8 values, the second 4 U8 values, and the third 2 U8 values. That will match the structure in your example. To get those to strings in LabVIEW, use cluster to array, and then byte array to string. You need to pass the empty cluster into the DLL call; the DLL call fills in the cluster and provides the values on the corresponding output. If you're dealing with C strings you should also know whether they include a terminating null, or if they're simply fixed-size character arrays.
For more help, please post the entire real header file, and any relevant LabVIEW code.

Similar Messages

  • Is Shared Variable Engine with LV8 an OPC server ?

    Hello
    Is the shared variable engine with LV8 an OPC server ?
    Does any OPC client can acces to Variable Engine OPC server an read shared variable ?
    Can I build an installer and deploy my application with Variable Engine OPC server on other PC without LV8.
    Thank you 

    Hi
    You can communicate between an OPC serveur and LV8 and use shared variable. To deploy an LV8 exe application, you must have the run time engine installed on the PC without installing LV8. You can create a setup with LV 8 in which you can integrate the run time engine.
    Kamal
    NIF

  • DSC: Importing Shared Variables results in error -1950679010

    This post is more of an "FYI" rather than a question.  I am using LV DSC 8.2.
    ASIDE:  I ran into this problem because I was trying to solve a related problem with Deploy Library.vi (I had dependant libraries that deployed manually, but not programmatically).  Eventually, I found the answer in http://digital.ni.com/public.nsf/allkb/8EF71E1DDDC36C908625716900594B50 (not a very satisfactory answer however, IMHO).
    During my solution search, another hint was provided with http://forums.ni.com/ni/board/message?board.id=170&message.id=177268&requireLogin=False which hints that using a "Network" defined SV, as opposed to a "Project" defined SV, could help.  Then I discovered the difference between NetworkrojectPath and Network:URL in the SV property definition.  Then I realized that NetworkrojectBinding is exposed in the Import fields (using the Multiple Variable Editor to do the importing of course), and this gave me the idea of being able to define a Network SV using the Import function.
    Unfortunately, it does not work.  In the csv file I set NetworkrojectBinding to FALSE, Network:UseBinding to TRUE and provide a valid Network SV path, but this results in error -1950679010: "Shared variable is bound but path or URL is not specified", which occurs when trying to save the LVLIB.  It would be nice to know why this doesn't work, as I think it should.  I think it is a problem with the SV import mechanism.
    David Moerman
    TruView Technology Integration Ltd.

    Yes, you can do this programatically.  I've attached a small chunk of example code (LV 8.5) that creates just 1 variable, as well as an image of it in case you are using an earlier version of LV.  If you want to create multiple variables for the same library just put the "AddSharedVariableToLibrary" in a loop, of course.
    David Moerman
    Attachments:
    Create Library and SV.PNG ‏48 KB
    Create Library of SVs - BASIC.vi ‏24 KB

  • Shared variable engine with pro-face touchscreen windows 2000 professional

    hello,
    who has some experience with the shared variable engine from LabView 8.5 and a touchpanel from Pro-Face?
    We try to deploy shared variables from the touchpanel but it doesn't work. Additionally the windows service ni shared variable engine dosn't start and we can't start it manually .
    The touchpanel is a PS3701A from Pro-Face with Windows professional 2000 for embedded, Pro-Face told us that we have the full service of Windows 2000 professional on a regular PC.
    Many thanks in advance
    derN

    Hi Andrew,
    Thanks for the feedback!  Your feedback will help us to improve LabVIEW for our customers.  This bug has been reported to R&D (#45493) and they are currently investigating this issue.  For now, the best workaround appears to be using a different OS, as this seems to only occur in Windows 2000.  Thanks for the feedback!

  • Shared Variable Conflict with RT Startup App

    I think I am running in circles trying to determine what my problem is.  Please look at the screenshot I have attached.
    I setup three different network shared variables (two in one library, the third in a second library) on my RT target.  I have deployed them manually probably half a dozen times.  I then build the executable, and tell it to make it a startup app.
    I then created alias shared variables on my user computer.  They are setup as PSP variables that I linked thru the dialog boxes NI provides.  A sample URL of one of these variables is:  \\169.254.0.2\rtDataRouter\Data
    I deployed this library on my user computer.  From what I was reading, I am not sure if that is the correct thing to do if I am having the RT target host the main variables (we want to be able to hook up multiple clients at remote locations, hence have the RT host them).  So I tried it both ways, with the aliases deployed and without.
    If everybody is still with me, when I run pure development environment, Labview 2009 SP1, deploys everything to the RT, I then run my local app, it says it is deploying items, and then it runs, shared variables seem to talk to no problem.  Doesn't seem to matter if the aliases were deployed or not (I do have auto deploy turned off).
    Next, I try deploying the RT startup app, it reboots, I hit the run arrow on local machine, and I get the conflict window!   Again, I try manually deploying the libraries on both the RT and local machine, rebuilt the executable, reboot the RT, run the local app (still in development environment), and I get conflict window!
    Part of me thinks, I am simply missing turning one thing on or off.  From the tutorials on NI's site, I think I am in the ballpark, what am I missing???
    My project is 99.99% done other than getting the executables done.  Any insight and help you can give would be HUGE for me to get this out the door!!!
    Attachments:
    screenshot.jpg ‏301 KB

    Make sure you have Autodeployment turned Off on your cRIO targets as well as your Windows Target.

  • Help With Simple Function

    I was wondering if someone could help me out with a simple function I'm trying to create. I'm kind of new to functions in oracle and I don't know the exact syntax or what it expects from me. I would appreciate it if someone could look at this and point out what I'm doing wrong.
    CREATE OR REPLACE FUNCTION freshman_status_term(
    pidm IN varchar2
    RETURN varchar2 IS term
    BEGIN
    SELECT sgbstdn_term_code_eff INTO term
    FROM sgbstdn
    WHERE sgbstdn_pidm = pidm
    AND sgbstdn_styp_code = 'F'
    AND sgbstdn_stst_code = 'AS'
    RETURN term;
    END freshman_status_term;
    The goal of the function is to find out the term for when a student is listed as a freshman. I keep getting errors though, so something must be wrong with it. Any help is appreciated. Thanks.

    Sven W. wrote:
    >
    My code looked exactly like that minus the exception part when I got the error before.Please post the code that you used and the full error message that you got.CREATE OR REPLACE FUNCTION freshman_status_term(
    pidm IN varchar2
    RETURN varchar2
    IS
    term sgbstdn.sgbstdn_term_code_eff%TYPE;
    BEGIN
    SELECT sgbstdn_term_code_eff INTO term
    FROM sgbstdn
    WHERE sgbstdn_pidm = pidm
    AND sgbstdn_styp_code = 'F'
    AND sgbstdn_stst_code = 'AS'
    RETURN term;
    END freshman_status_term;
    SELECT freshman_status_term ('216520') FROM dual;
    Error: PLS-00103: Encountered the symbol "SELECT" when expecting one of the following:
    ( - + ; case mod new not null <an identifier>
    The error is highlighted right after the BEGIN statement
    Edited by: user10548103 on Nov 6, 2008 8:53 AM

  • How is work "Get Shared Variable List with another computer " ?

    Hi all
    I can't receive the list of Shared Variables from   another computer  .
    From localhost computer I received it.
    Why?
    Regards
    Iskander

    First the stupid questions...
    Are you sure the variables have been deployed on the other computer?
    Are you sure you have the right IP Address?
    Could your IT department be blocking you?
    Could Windows firewall be blocking you?
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Cannot go to Select Functions to Convert windows for Import Shared library dll

    Hi, 
    As you can see the steps below, i cannot go throgh the Select Function to Convert windows after i click next on Configure Include path steps.
    any idea why is this happening?
    i am using Labview 8.5 and WinXP OS.

    It would help if you provided the DLL and the header file.
    Also, I think the third screenshot was intended to be something else, since it's the step where you specify any additional header files to reference, and not the step where you select what functions to import.

  • Import shared library(dll)

    Salut.
    I want to import the GetVolumeInformationW function from the Windows kernel32.dll.
    Microsoft says:
    Requirements
    Client
    Requires Windows Vista, Windows XP, Windows 2000 Professional, Windows NT Workstation, Windows Me, Windows 98, or Windows 95.
    Server
    Requires Windows Server "Longhorn", Windows Server 2003, Windows 2000 Server, or Windows NT Server.
    Header
    Declared in Winbase.h; include Windows.h.
    Library
    Use Kernel32.lib.
    DLL
    Requires Kernel32.dll.
    Unicode
    Implemented as GetVolumeInformationW (Unicode) and GetVolumeInformationA (ANSI). Note that Unicode support on Windows Me/98/95 requires Microsoft Layer for Unicode.
    1- I start the wizard, select "Create VIs for a shared library" then click next
    2- Then select C:\WINDOWS\system32\kernel32.dll for the shared library.
    3- Then select C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include\WinBase.h for the header file
    4- Click next
    5- Add C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include to the include path (for Windows.h)
    6- Click next...wait
    7- Then NI says :
    The shared library contains 949 function(s), among which the declarations of 0 function(s) are found in the header file and these function(s) will be imported. The remaining 949 function(s) listed below cannot be imported.
    How can i make it work? Is it possible?

    Hello,
    I just downloaded the SDK and attempted the same operations you
    described, with identical results.  I suspect that the problem is
    that the WinBase.h header depends on predefined symbols that are not
    present by default in our implementation of the DLL importer.  I
    haven't spent enough time examining the code to tell you precisely what
    these symbols would need to be, but that is where I would focus my
    efforts.  According to Microsoft, you may want to try defining
    NTDDI_VERSION, as per this document.
    Cheers,
    Matt Pollock
    National Instruments

  • Need help about a dll with panel function

    Hello,
    I try to create a DLL file with a graphical panel, and i want to use it on an other platform with visual c++ compiler.
    to release this DLL, i use an UI and generate a code with the option : Tools\UI to Code Converter.
    now i have a code which can create a user interface without the file .uir
    During the compilation there is no error, but when i want to test/execute it on Visual C++, I have an error message : The memory cannot be read, address 0x00000000.
    Someone can help me about this? and if you want my project to see the code, i can give it.
    thanks.

    One quick question: are you trying to avoid needing to install the LabVIEW runtime on the target machines?  If so, I don't believe packaging it in a DLL will accomplish that.  (Correct me if I'm wrong, but I think LabVIEW created DLLs still have dependencies on the LabVIEW runtime.)
    In general though, I agree with your suspicion as to why it isn't working.  One test you could perform to clarify the situation would be to added another VISA write and DLL read in line after the second form in your attached JPG.  If the resource is hosed up after your DLL read also, I agree, it would point to the DLL calls causing the resource to hang.  Perhaps the process of translating the VISA resource name from a string to the actual resource object causes the VISA session to be tied to the scope of the DLL function call (hence automatically releasing when the call is completed)?  If so, maybe passing the actual VISA resource name would help.  The VISA resource is really nothing more than a pointer to an object (a LVRefNum).  From the perspective of language independence, I think that probably amounts to a 32-bit integer.
    Also, perhaps you could just avoid building this level of granularity into the DLLs?  The idea of creating a DLL is to abstract away some complex task.  I'm not sure what benefit you get of creating DLLs out of such basic functions.
    Anyway, good luck. 

  • Dbms_lob.substr ( difference with  simple function substr)

    Hello  suppose the following query
    SELECT employee_id, resume,
                  DBMS_LOB.SUBSTR (resume, 5, 18)  lob_substr,
                  substr(resume, 5, 18)   sub   
    FROM employees
    WHERE employee_id = 170;
    resume is of CLOB datatype
    and for employee_id 170 is 'Date of Birth: 1 June 1956 Resigned: 30 September 2000'
    the results are:
    sub
    ' of Birth: 1 June '
    I understand that.
    I cannot understand why  DBMS_LOB.SUBSTR (resume, 5, 18)  gives as a result
    'June '
    Thank you.
    What is the difference?

    Sorry, I found the answer myself.
    dms_lob.substr is different from function substr
    DBMS_LOB.SUBSTR(lob_column, no_of_chars, starting)
    no_of_chars : how many characters it will return, so in my example, 5 characters will be returned, that's why 'June '
    starting from position 18

  • CRIO and ni 9234 modules not working or communicating through fpga with accelerometers, fpga connected to real time application which is also connected to shared variables linked to modbus slave

    Hi,
    I have a compact rio which has a 4 way chassis attached to that chassis is three ni9234 modules they are linked using fpga to a real time application then using shared variables in the low speed loop that are linked to a modbus slave to communicate with dcs, the ni 9234's have accelerometers connected to them with iepe ac coupled option on the c modules, my problem is the real time application seems to be running okay even when power loss occurs it restarts with no problem and the fpga writes to the portable hard drive bin files fine but without a accelerometer connected I get low noise readings as soon as I connect a accelerometer to any one of the 10 outputs it just goes to a fixed number (0.03125) as soon as disconnect it again it reverts back to reading noise, I have run a scan on the modules and only get a spike when I connect or disconnect the accelerometer, I have tested the voltage at the pins of the module and I get 22 volts dc which makes it more likely that the hardware is not the problem but a software is maybe causing this to hang-up, I attach project and files for your perusal. I also carried out a new project which in scan mode directly linked the module input to shared variable and the same scenerio again. Help would be much appretiated. 
    Many thanks
    Jason
    Solved!
    Go to Solution.
    Attachments:
    logger 2plusmodbus2.zip ‏679 KB

    Whren using waveform acquisition with the 9234s we recommend the following FPGA and RT template.
    http://sine.ni.com/nips/cds/view/p/lang/en/nid/209114
    it can be extended as a data logger with:
    http://zone.ni.com/devzone/cda/epd/p/id/6388
    or using shared variables combined with scan engine
    http://zone.ni.com/devzone/cda/tut/p/id/9851
    The FPGA in all of these, as well as the RT framework have been used successfully by 1000s of users.  I would recommend giving these a try. 
    Preston Johnson
    Principal Sales Engineer
    Condition Monitoring Systems
    Vibration Analyst III - www.vibinst.org, www.mobiusinstitute.com
    National Instruments
    [email protected]
    www.ni.com/mcm
    www.ni.com/soundandvibration
    www.ni.com/biganalogdata
    512-683-5444

  • Creating and loading 4000 shared variables

    I need some help laying out the design of this system.  The data is coming over reflective memory.  I've written a dll and a simple server to do the interface between the reflective memory and shared variable engine.  Everything seems to be working.  The problem I am having is with scaling the application up to handle approximately 4000 variables.  I have a spreadsheet to manage the reflective memory allocation and can use it to import the shared variable definitions with the names from the system that is writing the data.
    I am having trouble deciding on the best way to proceed.  I would like to read a buffer from reflective memory instead of reading 4000 times.  I also would like the server to read in a file that defines the association between the shared variable and reflective memory address.  The problem I am having is getting the data out of an array into each of the shared variables.  I don't see a way to load the value of a shared variable using the property node (so that I can do this inside a loop).  I also can't setup an alias that would access an array element.  I don't want to manually create 4000 variables.
    Any ideas would be appreciated.  Thanks.

    I have never had to resort to creating Shared variables programatically so I will leave that for others.
    I would cheat.
    In LV 7.1 DSC i could import my tag config from a csv file. After importing and saving in LV 7.1 I could let LV create the SV's when the code is updated.
    THat all assumes I will only have to do that one.
    I have used the interupts fired when SCRAMNet locations update to "steer" the value to appropriate code which could then in turn update the SV using a datasocket write since I can compose the URL for the SV dynamically.
    Just sharing ideas,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Datasocket and Shared Variables

    I am curious if there is any advantage to using Datasocket to read/write shared variables (as opposed to a direct read/write).  I'm specifically talking networked shared variables here.
    Is there any speed advantage to accessing shared variables thru the Datasocket functions?  Since both a direct read/write and a Datasocket PSP read/write talk to the same variable engine I assume they are equally efficient but I'm looking for confirmation here.  I've seen benchmarks for shared variable performance but none of them use DS/PSP to access the variables.
    Normally I would not even think of using Datasocket to access shared var's but where I currently work we have a large app that does this and it works great.  I suspect that this functionality only exists in LV8.x for backward compatibility and non-Windows OS compatibility and is not really meant to be used for new, Windows-based apps?   Am I off base on this?
    I am working in LV 8.5, BTW.....

    Hello Jared,
    Thank you for the reply with clarification. 
    Based on your comment, I changed the buffer parameters and also tried the programs with two different data types, previously StringArray and now String.
    In the attached LV8.6 project, you have all the programs, and shared variable library to review my tests. 
    There are two sets of two files - each set has a Write Shared Variable and Read Shared Variable file. One set is for StringArray type Shared Variable (named StrArr in the library), and the other set is for String type Shared Variable (named Str in the library).
    String Array example:
    MultipleDS-Write-SharedV-StrArr.vi / MultipleDS-Read-SharedV-StrArr.vi
    In my String Array shared variable, I use only 4 element array, each having 4 character strings - meaning 16 bytes per String Array data. I have two loops in the write file, writing to the same variable, an array of 4 strings, each loop continues until the loop index is >0. This means, sometimes, depending on the processor speed, the variable will be written 3 times or 4 times (the variable could have a new value before the loop condition is checked).
    So this means, if I have buffer of 100 bytes (16*4=64<100), it's enough for 4 such arrays (of 4 elements, each element with 4 characters) could be buffered to have sufficient time at the client (Read) program to read them. 
    I am putting 2048 bytes in buffer, which is much more than sufficient in my case. 
    The writer loops run with 200 ms to wait for each iteration. The reader loop runs with 100 ms in DS timeout and 100 ms in wait timer. This gives results without any loss. However, if I run the reader loop with 1000 ms to wait for each iteration, the data is lost. The buffer is not maintained for 2048 bytes.
    In the read program, just to make sure if all data is read or not, I am showing data in two different string indicators, showing data of each loop.
    String example:
    MultipleDS-Write-SharedV-Str.vi / MultipleDS-Read-SharedV-Str.vi 
    The String Array shared variable didn't show values in the Distributed System Manager. Hence, I created another simple variable with String datatype.
    The writer program writes strings of 4 characters, one-by-one, in two loops. Meaning, total 8 strings of 4 characters each are written in the "Str" Shared variable. 
    The reader program, however, doesn't always display all the 8 strings. Although the wait timer is not high (slow) it still misses some data usually. Data is overwritten even before the buffer is filled (in buffer, I have defined 50 strings with 4 elements in each).
    In both of the Read programs, I read using datasocket. I think thought datasocket has more ability to buffer. Earlier I had "BufferedRead" in DataSocket, which I have changed to just Read, because BufferedRead didn't give any special buffer advantage in the Shared Variable reading.
    ---- This is an update on the issue. 
    Ok, just while typing the last paragraph above, regarding datasocket, something clicked in my mind, and I changed the DataSocket functions to simple Shared variables (completely eliminating datasocket functions) in the read programs as well. And bingo, the buffer works as expected, even if I have reading loops very very slow, there is no data loss in any of the program sets. 
    The two changed Read programs are also included in the attached project - MultipleSV-Read-SharedV-Str.vi and MultipleSV-Read-SharedV-StrArr.vi
    So this means, I can completely eliminate DataSockets (not even using PSP URLs in DataSocket Open/Read functions) from my programs. 
    One question here, what will be an advantage of this (or any side effects that I should be keeping in mind)?
    Vaibhav
    Attachments:
    DataSocket.zip ‏71 KB

  • Modbus Ethernet read and write to a Eurotherm 6180XIO Modbus server using LV8.2 shared variables

    I am having EXTREME difficulty trying to establish communications with a Modbus device using LV8.2 shared variables.  The device is a Eurotherm 6180XIO Datalogger configured as a Modbus master.  The PC and a cFP-1804 are slaves.  All IP addresses are set correctly.  This approach using shared variables would seem simple, but I can't find any examples or proper guidance on how to get it working.  I am trying to avoid having to mess around with TCP/IP, OPC, or any other old-fashioned method.
    I have read many threads on related topics but none directly apply to this situation.  I have created a library containing a Modbus I/O server and shared variables bound to read and write holding registers.  I have followed all recommended tips for creating such variables but I can neither read or write data.  All data types are U16 due to Modbus protocol limitations.  I have also applied the LV x10 factor in the most significant digit in the register offset (6 digits instead of 5).
    I have a cFP-1804 on the same network which reads into the datalogger OK.  The registers I use are 31000 (for CH0 on module 0, 31002 for CH1, etc) and the data can be read as FLOAT32.  I have updated the firmwate on the 1804 to the latest level.  I cannot even get shared variables to read SGL values.  Using registers 301001 for CH0 and 301002 for CH1 I can only read U16 values, and not a 2-word SGL.
    Third party Modbus simulation software is able to write to and read from registers very easily, but not LabVIEW.
    Some questions are:
    - do I use a Modbus master or slave as an I/O server in the library as a target for binding the shared variables?
    - is there some other wierd translation in register offsets between LabVIEW and traditional Modbus?
    - is this actually possible using shared variables or am I wasting my time?

    Sending the whole 60-character string using a string or array would be the most efficient.  I have tried both methods, and these only cause the datalogger to flag a message log but no text is displayed.
    For a string variable, I have used the following binding "My Computer\Modbus Test.lvlib\ModbusServer6180\442305", where ModbusServer6180 is a Modbus I/O server configured with the logger IP address, and 42304 is the register offset at the start of the text block in the logger.  I need to write to 30 consecutive registers starting with this one.  I am not using buffering and have not enabled single writer.
    Can anyone confirm whether this method should work in 8.2?
    Does the string need a special termination character?

Maybe you are looking for

  • Simple question: Physical wireless switch, and booting

    This is a question for those who have a laptop with a switch that enables or disables the wireless network: Do you have to manually press this button before you want to establish a wireless connection? Until kernel 2.6.31 I could start my wireless co

  • Scheduling agreement releases in ME84

    Hi All, I have create a scheduling agreement and maintained the same in a source list. The after I executed MRP (MD02) schedule line were created for the scheduling agreement from the MRP run. But now when I go to Txn ME84 and try to create releases

  • Smart objects slowing down computer

    Hi - I'm making animations in PS6 extended using timeline. Some of the files are a bit hefty - 5 or 6 smart object files deep -  and are making the computer go really slow [I have 8GB RAM and 1067Mhz]. I wondered if it might be caused by too many bit

  • Error:First create the valuation-type-independent data:BAPI MM

    Hello all, I am getting above error (First create the valuation-type-independent data) when i sent the BWTAR field to BAPI_MATERIAL_GET_ALL and material data is not getting fetched. Please guide to resolve the issue. Thank you. Edited by: sanjivrd on

  • Hi I hope somebody can help me.

    i had an iphone which was locked to 3 network in UK. after unlocking through network provider, i gave it to my brother to use in india. But unfortunately its not picking up any network availiable in india. When i checked in internet it shows that the