Configuring array of byte in dll call

Dear all,
I need to send the data 2010010100H to the dll at the question mark(U8) i mentioned in the attachment. Actually the data has to be transferred at a time not in bits and pieces. How to do this? I just put an array constant. Is it correct? Kindly give suggestions asap.
Thanks,
Mathan
Attachments:
1.PNG ‏10 KB

Hi mathan,
the dll call in your pic only accepts single bytes (U8) - so no way to wire an array!
why do you create so many new threads, when the topic doesn't change?
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome

Similar Messages

  • Error Code 1097 Coming in DLL Calling

    Hi,
    I am getting error code 1097 in DLL calling function. Please find the DLL calling function details for more information.
    Function :  GetControllerListTest(controller *ptrControllertest,char *max_controller);
    Controllertest parameter details:
    define NO_OF_CONTROLLER  100
    #ifndef CONTROLLER_STRUCT
     typedef struct
      CString name;
      char status;
      CString blocked_by;
      char group;
     }controller;
    Controllertest parameter data type is structure. In LabVIEW, I have configured parameter as a cluster.
    name : String control
    status : U8 Integer control
    blocked_by : String control
    group : U8 Integer control
    Could you please confirm it, did I configured the datatype in correct way?
    I am getting empty array output and Error Code from the DLL 1097. Can you please tell me where I am missing?
    Thanks
    Sivaramkumar.V
    Solved!
    Go to Solution.

    Call Library Node problems without the VI in question attached AND the complete C prototype of the function provided, AND preferably some documentation about the C function in question can be not diagnosed. These informations are paramount to get the Call Library Node configured properly since there is no way a calling application can retrieve the necessary information from the DLL itself. The DLL interface was never intended to be a self configuring interface and it was designed with the understanding, that the user of such an interface is a fully knowledgeable C programmer knowing both, how to read a header file definition as well as various details about memory buffer handling.
    So show us your VI and the C header file, and we can start to help you. Otherwise all we can do is guessing in the way you have done with changing the calling convention randomly. You can of course try to shoot in the shooting range with a blindfold on, but the chances that you not only do not hit the target, but injure some other person instead is very high.
    The only reason that the suggestion from Fragger Fox has any merits is the fact that LabVIEW used to have some heuristics that changed the Call Library Node automatically from C calling convention (the LabVIEW default) to Windows calling convention, if it recognized a certain pattern in the exported function name. This heuristic was removed in LabVIEW 2009 because it did prevent the Call Library Node to be able to call functions that were using C calling convention but happened to match the heuristic pattern. So changing a Windows calling convention to C calling convention when the code has "seemed" to work before is NEVER a solution.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to response polling event during dll call

    Hello,
    There is a long time dll call in my program. The program doesn't response to mouse click in the front panel during the dll call when I want to display other page in Tab control. It only response after the call.
    How to solve the problem?
    Thanks!

    Wether or not it is possible to fix this situation is dependent on the dll itself.
    IF
    the dll is written to be re-entrant (thread-safe)
    THEN
    you can configure the Call Library function to not run in the user interface thread. This can be done by right-clicking on the node and selecting "configure". In the configure screen, ther is a drop down selection box that defaults to "Run in UI thread". Change this to re-entrant.
    You can then determine which thread the dll runs in by setting the properties of the calling VI.
    Warning!
    If the dll is not re-entrant you WILL experience random crashes and possible data coruption! All bets are of if the dll is used in the wrong manner.
    What is happening:
    LV's execution systems are multi-thread with the exception
    of the UI thread. The UI thread is single threaded to ensure updates of control and indicator information is updated correctly, etc. This thread also uses co-operative multi-tasking wherein a proccess is expected to "put itself to sleep" regularly in order to allow other proccesses in that thread to gain access to the CPU. Your dll is dominating this thread and prevent user actions to be serviced!
    Final note;
    If you do not know if the dll is thread-safe and decide you just want to experiment,
    BACKUP YOUR ENTIRE MACHINE!
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Failure: "gnrclist.cpp" after a DLL call

    Forum:
    Since adding dll calls in a VI, LabVIEW is frequently crashing, both during VI execution and after exiting the application.
    Generally, what issues need to be considered when making successful dll calls (using the "call library function").
    Jordan

    Hi Jordan,
    It sounds like this issue is due to the fact that you are not allocating memory for the dll in advance. This is the most common mistake when implementing a dll in LabVIEW.
    For instance, if your dll is going to output an array of 100 double-precision numbers, then you need to allocate this place in memory by passing the dll a dummy array of 100 double-precision numbers that it can operate on. Also be careful not to expand the size of the array. LabVIEW doesn't support dynamic memory allocation within a dll in most circumstances. If you don't allocate a place in memory in advance, LabVIEW may crash when you exit the program and LabVIEW tries to deallocate memory.
    A really good example of allocating various types of data for use in a dll is available from the Example Finder (Help >> Find Examples from LabVIEW).  Click the Search tab and search for the term DLL. The Example is called Call DLLs. It contains c code that corresponds to various dll functions that operate on various data types, and it shows you how to call these dll functions properly from LabVIEW. For a more comprehensize overview of the process, refer to the document Using External Code in LabVIEW, available here, or browse through these Developer Zone examples and applications notes.
    Jarrod S.
    National Instruments

  • Does a reentrant dll call monopolize the calling thread?

    If I understand thing correctly, threading for a dll call is the same as threading for a vi whose execution priority is set to subroutine.
    To review threading in subvis:
    (1) the thread in which a subroutine-execution-priorty-vi call is made is monopolized by the subroutine-execution-priorty-vi since labview cannot time slice the thread.
    (2) if the subroutine-execution-priority-vi is not reentrant, then other threads that call the vi may be suspended because they are competing for the same code resource.
    (3) if the subroutine-execution-priority-vi is reentrant, then other threads may call the vi simultaneously. However, within any particular thread the vi must complete because of point (1).
    In
    sum, the OS timeslices between the threads, and labVIEW timeslices within the threads. If a vi's execution priority is set to subroutine, then the thread under which it is running is monopolized by the vi. Yes?
    A reentrant dll call would be equivalent to a reentrant subvi call in which the subvi's execution priority is set to subroutine. Yes?
    If the above is correct then this should also be correct:
    Using an API call to return the thread ID, you could use the the thread ID at the front and back side of a dll call, as well as in a message library function callable from a dll, to theoretically message labVIEW upon the dll return. The message would be uniquely identifiable because a dll call cannot be superceded by another dll call from within the same thread. Yes?
    I'm not saying that it would be particularly efficient to do so, only that it could be done. And depending on the messaging, it could be a useful option in the dll call configuration dialog box.
    In consider
    ation of "magic",
    Kind Regards,
    Eric

    Eric,
    I'm not sure I understand exactlly what you are trying to do here.
    If you want LV to react to a dll error, why don't you just pass a return
    code that's not zero? Then, back in LV, read the return code. If it's not
    zero, create an error, and pass this to the rest of the code. The rest of
    the code is (or should, following good programming practise) has an error
    in, and the code will not execute if the input error is TRUE. It does not
    even have to be the return code, it could be any input value. The input
    values can be changed in the code, and the modified value is returnd to
    LabVIEW.
    If you want to generate an error, and put it into a buffer to be read later
    on in LV, you'll have to synchronise the code. This is the consequence for a
    construction like this, and is the same for several windows API's
    (GetLastError, etc.). the buffer will stay in memory, untill all instances
    of the dll are released from LV memory.
    BTW: A dll could create another thread. This thread can run on the
    background, like the good old TRS's in dos. (A thread like this could even
    call a LabVIEW VI that is build in a dll, just like any other api.)
    BTW: A thread created by a dll can be made to be automatically released when
    the thread is detatched, or when the process is detached. This is important,
    because LV will crash if the dll is removed from memory, but the thread is
    not stopped properly.
    Regards,
    Wiebe.
    "Eric6756" wrote in message
    news:[email protected]...
    > Greg,
    >
    > As I think I lost you in the point of this line of questions, let me
    > back up.
    >
    > A couple of week ago I asked the following question, "Is there a
    > labVIEW library call that can be made from a dll to tell labVIEW to
    > abort the calling vi thread?" To that question you made the following
    > statement:
    >
    > "... and I doubt that there is a function to do that from a DLL as the
    > DLL could be arbitrarily deep down the stack and the function called
    > would have to magically find the VI that it wants to abort. And don't
    > forget that DLLs can be called by multiple VIs at the same time."
    >
    > You seem to be saying here that what I'm asking for is not possible.
    > And having thought about this for a while, I didn't understand why
    > not.
    >
    > For the moment I'm going to ignore the caveat you just put into the
    > dll calling presumptions I've made and assume the dll is going to
    > execute synchronously within a thread. As the original question
    > suggests, the objective here is to message labVIEW from a dll to
    > provide the same functionallity as a CIN, namely return an error code
    > to labVIEW from a dll.
    >
    > A library function could do this as follows:
    >
    > First, the library function would have two modes; set error, and
    > return error
    >
    > (1) set error:
    >
    > 1.1 get the set error caller thread ID from API
    > 1.2 get the passed in error
    > 1.3 store the error and associated thread ID locally
    >
    > (2) return error
    > 2.1 get return error caller thread ID from API
    > 2.2 locate the error, if any, associated with thread ID
    > 2.3 return the error and clear it locally
    >
    > Now, if a dll encountered an error that it wanted labview to deal
    > with, it would call the error function to set the error code. When
    > the dll call returns control to labVIEW, labVIEW could call the
    > function to return the error. This of course works only if the dll
    > call is synchronous within a thread. Obviously, if the dll releases
    > the thread before it returns, then more than one dll call can be made
    > from the thread and the presumption that an error could be uniquely
    > associated with a thread is itself an error.
    >
    > Having looked at your reply again, I think though your answering a
    > different question than I asked. I just wanted a function to message
    > labVIEW to abort the vi chain, I don't want to abort a vi chain from
    > within the dll. It is a feature of CIN calls which I wanted in dll
    > calls.
    >
    > That a dll call may not be synchronous within a thread throws a wrench
    > in the works. Apparently I've just chased down a dead end.
    >
    > Hey, but thanks for the wrench...
    > Kind Regards,
    > Eric

  • Converting an array of bytes to an image

    I think this is the right forum for my question.
    This code comes from the J2ME side of my application. It reads in an int from my server, and if its over a certain length, I can tell its an image so i can decode it from an array of bytes back into an image, but it throws an IllegalArgument Exception on image = Image.createImage(b,0,length);
    I've decoded the byte array before it gets sent and convereted it back into an image and that works, and ive run the debugger and the array is full of numbers on the J2ME side of the app, but the call to createImage, just keeps throwing this exception and i can't find an answer. If you need anymore code, I'll post it.
    int l = in.readInt();
    imageArray = new ImageItem[l];
    for(int i = 0; i < imageArray.length; i++){
    byte[] b = null;
    int length = in.readInt();
    System.out.println("length = " + length);
    if(length < 10) {
    imageArray[i] = null;
    System.out.println("null image");
    } else {
    b = new byte[length];
    in.readFully(b,0,length);
    System.out.println("image not null");
    Image image = Image.createImage(b,0,length);
    System.out.println("hit");
    ImageItem imageItem = new ImageItem("null", image, 0, "null");
    imageArray[i] = imageItem;
    If anyone can tell me how to indent the code, i would appreciate it, it looks indented when i post it my side.
    Message was edited by:
    trisonetwo
    Message was edited by:
    trisonetwo

    If it works before sending then check your code for sending the image.
    Also you can compare the byte array before sending with the array which was received at the other end.
    For indent and syntex highliting use [ c o d e ] and [ / c o d e ] tags (without spaces)
    Ex:-
    int l = in.readInt();
    imageArray = new ImageItem[l];
    for(int i = 0; i < imageArray.length; i++){
       byte[] b = null;
       int length = in.readInt();
       System.out.println("length = " + length);
       if(length < 10) {
          imageArray = null;
          System.out.println("null image");
       } else {
          b = new byte[length];
          in.readFully(b,0,length);
          System.out.println("image not null");
          Image image = Image.createImage(b,0,length);
          System.out.println("hit");
          ImageItem imageItem = new ImageItem("null", image, 0, "null");
         imageArray = imageItem;
    }

  • Trying to get dll calls to work like c++

    Hi,
    I understand there have been many posts about dll files.  I have reviewed them and found nothing that helps me.  I have a segment of c++ code that communicates with a digital correlator, reading data from it.  The c++ code works fine, but when I wrote the code in Labview, I get results that are reasonable sometimes....sometimes I get good data, sometimes odd data, and sometimes no data.  The c++ code ALWAYS yields good data.  The function prototypes in each of the call library functions matches that in the c++ code. 
    The C++ code is attached.
    NOTE THAT there are a few things (like calculating delay times and writing to file I don't do in the labview code).
    The labview code never outputs any values in TraceA or TraceB, which should be values around 300,000.  The DLL location is set correctly, as evidenced by the fact that the code works....just not consistently.
    Any help would be greatly appreciated.
    Josh
    Attachments:
    Correlator.vi ‏38 KB
    sample.cpp ‏6 KB

    Your message is very clear!
    I have no idea how the fact that this particular code was made to work would help you unless you try to use the same DLL which would seem rather strange. As to what the OP posters problem was:
    One has to provide buffers to DLL functions for ALL parameters when one calls them. Yes LabVIEW does take care about buffer allocations everywhere else so you don't have to worry about that, but when calling C code, LabVIEW can't even guess what buffers the function may need. And therefore it correctly doesn't try to guess at all.
    Those arrays that the function should write into, have to be allocated BEFORE one calls the function. It's the single most problem why DLL calls don't work as expected either returning rubbish or crashing. And anyone claiming to have read all the posts about DLL calling on this board or also on lavag.org should have gotten across at least two dozen messages from me where I pointed that out and explained it in detail.
    in detail: The graph arrays do get initialized but in the same frame all control get initialized to default. That is completely wrong! one does either one or the other but not both and definitly not in the same frame because of uncertainety which is executed first.
    nTrace is initialized to 0 and then used as indication in the CallLibrary Node, how large the array needs to be. Well a 0 element array is just that an array of no content, therefore a buffer that can hold no information and therefore it's sheer unluck that the Call Library Node doesn't crash.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How can I convert an array off byte into an Object ?

    Hi folks...
    I�m developing an application that comunicates a PDA and a computer via Wi-Fi. I�m using a DataStream ( Input and Output ) to receive / send information from / to the computer. Most off the data received from him is in the byte[] type...
    How can I convert an array off byte ( byte[] ) into an Object using MIDP 2.0 / CLDC 1.1 ?
    I found on the web 2 functions that made this... but it uses a ObjectOutputStream and ObjectInputStream classes that is not provided by the J2ME plataform...
    How can I do this ?
    Waiting answers
    Rodrigo Kerkhoff

    There are no ObjectOutputStream and ObjectInputStream classes in CLDC. You must know what you are writing to and reading from the DataStream. You should write the primitives like int, String to the DataOutputstream at one end and read those in exactly the same sequence at the outher end using readInt(), readUTF() methods.

  • Getting error while tring to Check in any document in Sharepoint 2007. Error - "Unable to validate data. System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) ...

    Hi Team,
    I am getting error while tring to Check in any document in Sharepoint 2007. Error - "Unable to validate data. System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength).
    Anybody please let me know how to resolve the issue. It has affected our 9 site collection with almost 2000+ sites. Please email me your your suggestion or you can share your ideas here also.
    Tried to reset the IIS, checked the Internet connection speed (8MBps). Cleared the cache and all but no luck.
    Thanks,
    Pronob

    Hello,
    I have found this support window for you:
    http://support.microsoft.com/kb/556031
    http://technet.microsoft.com/en-in/library/cc298582%28v=office.12%29.aspx
    This may help you
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How is it possible to make sure that LV uses the same thread for several threadsafe DLL calls?

    Hello,
    i have a thread safe DLL and most functions are called from serveral threads from the LV apllication without problems.
    In case of an error i have to call an error handler function in this DLL (like WinAPI: GetLastError()) from the same thread which has called the function that failed before.
    I can't use the user interface execution because some functions need a long execution time and i don't want to balk the user interface.
    All other executions than the user interface execution have more than one thread and in most cases the DLL function calls were executed from different threads - so the error handling doesn't work...
    Any idea?
    Thanks for your help!

    Hmmm....
    How about wrapping all of your dll calls in a single VI (or an Action Engine ) and make sure the VI's thread is NOT set for "Same as caller".
    "Threadconfig.vi" (sp?) will also let you dictate the number of threads associated with an execution system. Set your target thread for "1".
    Not sure on the above.
    Please correct me if this is wrong!
    Ben
    Message Edited by Ben on 07-19-2007 08:26 AM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Array of bytes..

    hi..
    how can i convert array of bytes to string and vise versa
    thanks

    You can convert the string to a char array with String.toCharArray(), but if you want them as a byte array you have to first decide what character encoding should be used with the conversion. You can e.g. use "8859_1" if you only work with characters in the range 0 to 255. Then it would be String.getBytes("8859_1"). You have to add a try-catch block. It will throw an exception if you use an unsupported encoding. ISO 8859-1 is one of the basic supported encodings, so you will not get any exceptions when you use this.
    To go the other way, you use one of the String constructors.

  • Array of bytes containg punctuatio​n

    Hi, I have an array of bytes that I would like to export using the spreadsheet VI. The spreadsheet creates a file with the extension .res, which logs the array as hex values. The problem is, all my data is separated with a punctuation mark, which I guess LabView inserts into the array to separate the numbers.
    So my question is, is there any way to convert an array of U8's into a string of pure hex or just a stream of binary data?
    Thanks

    q-bertsuit wrote:
    Thank you for your answers, I'll try your link. The first suggested solution didn't work.
    You are not giving enough information. Did the second suggestion work?
    q-bertsuit wrote:
    I want to use the spreadsheet VI to make a .res file, saving as a plain text file would cause alot of extra work in MatLab.
    A "spreadsheet" in LabVIEW is nothing more than a plain text file with certain delimiters for columns and newlines delimiting rows. "Write to spreadsheeet file" is a simple tool for typical use. All the formatting can be done explicit and then written to a plain text file, the outcome is exactly the same. There is no extra work involved in Matlab.
    q-bertsuit wrote:
    I might not have explained the problem sufficiently in the first post. If my buffer containing U8s is passed in to the spreadsheet VI, the .res file saves for example the number 255 as ASCII character 2 then character 5 then 5. So 255 would be saved as 32 35 35 instead of FE.
    Again, write to spreadsheet file is not the right tool then, so don't use it.
    It is still not clear. So you have an array of U8. How should the file look like? Should there be any delimiters?
    Example: If you only write 255 to the file, should it contain
    one binary, nonpritable character (xFF)
    two charcters (two instances of the letter F)
    Three characters (letter 2 followed by two letters 5)
    If the array has two elements, how should the second character be stored? Should there be a delimiter (space, comma, tab, etc) or nothing separating it from the first value?
    Once we have the specifications, the rest will be trivial.
    LabVIEW Champion . Do more with less code and in less time .

  • Read array of bytes

    using what do i read array of bytes that is on a stream...
    i send an array of bytes to the invoking stream using void write(byte buffer[])....
    how do i read it from the other side....
    uzair

    Attempts to read up to buffer.length bytes into
    buffer, returning the number of bytes that were
    sucessfully read. -1 is returned when the end of the
    file is encountered.I wasn't asking you to post what the API says it does. We know what it does. Now, do you understand how it reads the bytes into the buffer that you pass to it?

  • Private dll calling in Labview

    Hi everyone, (refinement of my question)
    I have two dlls. One contains public functions which I call from Labview. The functions in this dll call functions in the other (private) dll. However, how do I tell Labview where to find this private dll?
    I have tried installing the dll in the system path directory. I have also put the dll in various different places relevant to Labview (e.g. in the directory of the Labview executable file). However, none seem to work (.
    Is there an option in Labview where I can set paths to dlls?
    Any help will be gratefully received.
    Ciao,
    Matthew Banham (colleague of Francois)

    > I have two dlls. One contains public functions which I call from
    > Labview. The functions in this dll call functions in the other
    > (private) dll. However, how do I tell Labview where to find this
    > private dll?
    >
    > Is there an option in Labview where I can set paths to dlls?
    >
    The problem is that the system loader is what handles the dependent
    DLLs. Since LV knows about the primary DLL, we try multiple locations,
    the path in the dialog, next to the VI, in the LV search paths, and
    finally we ask the system to look in their places. LV doesn't know
    about the dependent DLL, and it is up to the system to find it. I'd
    recommend trying the system or windows folder again. That should be the
    right solution.
    An off the wall thought that might h
    elp would be to add a dependency
    directly into LV by making a DLL node that calls in the the "private"
    DLL. You don't actually have to call it, you can place it in a case
    structure with a constant set the other way. Anyway, this will cause LV
    to look for the DLL, and I think it might help if nothing else works.
    Greg McKaskle

  • Array data sporadically lost when calling stored procedure

    We have weird problem with stored procedures for which I have not been able to find an explanation so far.
    Our app has a bunch of stored procedures which process arrays of integers or strings.
    From time to time (maybe 1 in a 1000) array data gets lost when calling stored procedures. From the logs we know that the data gets sent to the stored procedure, but on the DB side the procedure throws an exception because arrays are empty.
    We are using (modified) OracleConnectionCacheImp (thus PooledConnections, etc.). My latest guess is that maybe somehow ArrayDescriptors on the (pooled)connection used to call the stored procedure are somehow affected when another pooled connection from OracleConnectionCacheImp gets removed by parallel thread. Is that possible? Or are the PooledConnections internally (in pooled connection data source) completely isolated from each other ?

    We have weird problem with stored procedures for which I have not been able to find an explanation so far.
    Our app has a bunch of stored procedures which process arrays of integers or strings.
    From time to time (maybe 1 in a 1000) array data gets lost when calling stored procedures. From the logs we know that the data gets sent to the stored procedure, but on the DB side the procedure throws an exception because arrays are empty.
    We are using (modified) OracleConnectionCacheImp (thus PooledConnections, etc.). My latest guess is that maybe somehow ArrayDescriptors on the (pooled)connection used to call the stored procedure are somehow affected when another pooled connection from OracleConnectionCacheImp gets removed by parallel thread. Is that possible? Or are the PooledConnections internally (in pooled connection data source) completely isolated from each other ?

Maybe you are looking for

  • Delete Bookmarks From iPod Touch?

    How do you delete/wipe your bookmarks off your iPod Touch? I synced all of my Safari Bookmarks to my iPod Touch, but I've changed my mind. I don't want my bookmarks on my iPod Touch anymore. I can't find any obvious way of deleting or removing them,

  • Which server will get the load?

    Hi all I have 2 servers, on 'server1', I have an flv file, on 'server2', I have an swf file. The swf file on server2 loads the flv file on server1. My question is, which server will get the burden of the load of the flv file? Additionally, how can I

  • Photoshop CS6 bizarre behavior in Win8

    Don't yam that the OS is a beta: it isn't. CS6 worked stably with the consumer preview version but seems unusable with what will be the final version of Win8 (like possibly October). Win8 has its issuess but at least it isn't the senile Mac OSancient

  • FM /BAPI for applicant actions Tx code PB40 in sap hr

    Hello all..    Could you pls let me know the FM/BAPI for applicant actions (Transaction Code PB40) in  SAP HR ABAP Thanks in advance.. Cheers, sami. Moderator message: if it exists, you can find it yourself by doing some research. Edited by: Thomas Z

  • Lost "Energy Star" in the Energy Manager

    Hy@all! I have a problem: In the Energy Manager the point "Energy Star", but I have now two times the point "Maximum Performance" and I can't click an the field "restore defaults" and if I click on one of the "Maximum Performance", both points of "Ma