Different performanc​e for handling DLL function

Hi, all
I have some question about handling DLL function.
There is two test cases for the DLL handling for experiment.
Platform is as following:
Windows 98, LabWindows/CVI 5.5 (compatiable with Virsual C++), DLL library (built by C++ Builder 960 kbytes).
Case 1:
Use the LoadLibrary to load the DLL library (DLL_handle) and use the function (provided by DLL) to handle the COM port (COM_handle). And there have a hardware key for security check. For each command (provided by DLL) take 0.25 second to finish one command to handle the RS232.
Case 2:
Use LoadLibrary to load the DLL library (DLL_handle) and use the function (provided by DLL) to handle the COM port (COM_handle). And there
have a hardware key for security check. There have three threads working (use CreateThread to create with 1MB stack size), and pass the DLL_handle and COM_handle to the static libarty to do the desired job (took 1 second to finish the job for one command). In the static library, there use the DLL_handle to get the pointer of the selected function and use COM_handle to handle the RS232.
I don't know the reasons between these two cases.
If you have any suggestion or solution about it , please tell me detail.
Thanks,
Lambert Lin
My email address is [email protected]

Sir,
We do not have an exact idea of what your application is doing. However, it looks like the difference between the two cases is the use of multithreading in the second. It is possible that the delay is from the CPU having to "switch" between threads, and having to load and execute calls to the DLL once in the thread. I think you should look carefully into the structure of your applications multithreading to see if there are areas which could be causing delays in the execution of the DLL's functions.

Similar Messages

  • Firefox v33 not supported for firebreath dll function?

    ''locking a a duplicate of - https://support.mozilla.org/en-US/questions/1031785''
    Hi,
    i have call a firebreath default echo function in my firefox extension using firefox v33 browser. its not working, it returns type error:echo is not a function. But the same function successfully called in firefox v28. So whats the actual problem? why firebreath dll function not supported in firefox v33?
    note In echo function, i have create a messagebox to display while calling in that function. it shows in v28 but in v33 exception throws like type error:echo is not a function.
    Regards
    Bala
    ''put a space after the periods as it was creating links.''
    ----

    Does Firefox find that element if you run this code in the Web Console (Firefox/Tools > Web Developer)?
    <pre><nowiki>ngPluginObj = document.getElementById('myfirebreath');</nowiki></pre>
    Do you see the add-on enabled in "Firefox/Tools > Add-ons"

  • Action for handling YES/NO functionality in create_popup_to_confirm

    Hi all,
    I am creating several Popup window in the View using method create_popup_to_confirm of interface IF_WD_WINDOW_MANAGER.Is there any restrictions of creating Actions YES/NO only for button kind 'YESNO'.
    For each Popup can i create different actons for handling corresponding functionalities in different Methods.
    Can i use any suitable Action name for handling YES/NO functionality.
    Points will be sured.
    Thanks
    Sanket sethi

    Hi Sanket,
    Yes you can make the actions as you want by assigning the action name to YES/NO events.
    call method lr_wd_window_manager->create_popup_to_confirm
            exporting
              text         = lt_text
              button_kind  = '4'
              window_title = 'title'
            receiving
              result       = lr_wd_window.
      lr_wd_window->subscribe_to_button_event(
             exporting
               button            = if_wd_window=>co_button_yes
               action_name       = 'ACT_YES'
               action_view       = lr_view_controller
    lr_wd_window->subscribe_to_button_event(
            exporting
              button            = if_wd_window=>co_button_no
              action_name       = 'ACT_NO'
              action_view       = lr_view_controller
    Regards
    Amol Deshmukh

  • Complicated structure for DLL function

    I need LV6 to pass and get back parameters to a DLL function whose prototype is:
    int APIENTRY GetData(ACQDATA *Data)
    ACQDATA has the following structure
    typedef struct{
    unsigned long huge *s0;
    unsigned long far *region;
    unsigned char far *comment0;
    double far *cnt;
    HANDLE hs0;
    HANDLE hrg;
    HANDLE hcm;
    HANDLE hct;
    }ACQDATA;
    From the DLL documentation I could see that
    - the function modifies its argument
    - the (fixed) length of the second, third and fourth parameter is specified
    No idea of the length of "s0". I've tried several LV clusters including a cluster with four pre-allocated arrays (buffers) and four scalars. But no luck so far.
    If a C wrapper function is the only solution to pass the parameters correct
    ly, can anyone show me an example. Can I use the Code Interface Node for that purpose though I only own the Base Package version of LV or shall I write another DLL function?
    Please help asap

    Unfortunately I am new to C programming, but I'll try to give you the complete picture of what happens.
    There's no definition for HANDLE in the DLL documentation but windows.h is included, so I guess the following
    #define HANDLE void * //32bit?
    In my LV routine I tried U32 variables for the HANDLE typed parameters.
    In one of attempt LV passes to the function a cluster (I make no mistake with the order!) with four arrays and four U32, all of them preset to some value. Well.. these values (all)are not changed when the function returns. The return value of the function says no error, anyway.
    I tried other clusters: with and without arrays, with all (or part) scalars and all (or part) strings. No way either.
    Sometimes LV itself crashes, sometimes I get
    the original values I imposed before the call.
    I suspect the LV cluster structure makes me miss the right level of indirection for the first 4 variables in the structure (called *s0, *region, *comment and *cnt): when either I pass arrays or scalars as components of the cluster.
    Hope this helps you to help me
    Cheers
    Piero

  • DLL C/C++ syntax for Call Library Function Node

    Hello,
    I am interested in calling DLL from Labview and found several intersting tutorials on the Call Library Function Node. One interesting tutorial is Building a DLL with Visual C++ http://zone.ni.com/devzone/cda/tut/p/id/3056
    One can notice in the example presented in this tutorial that the parameters that are outputs of the exported function are of type pointers. And I am curious about the theory behind this. 
    I looked also at the example in LabVIEW Call DLL.vi and it seems that all outputs are pointers to the desired data type.
    I tried to write a short code where I assign a new value for one parameter in the export function. But this value is not updated in Labview. To make it clear: assume 50 is passed to an input parameter (on the left side of the Call Lib func Node). In the function, i assign 100 to this variable and expect this value on the output in Labview (right side indicator of Call Node) but the output remains 50.
    I am trying to change my code but i get errors in linking (compiling is ok) that I cannot understand. LINK : fatal error LNK1168: cannot open Debug/DoseDLL.dll for writing
    Error executing link.exe.
    I don't get any error with the code provided in the above tutorial   so i am trying to reproduce a similar code...
    Thank you

    Hello,
    Please find attached the source code in C, the DLL and the vi. 
    you notice in the C code that I set variable dose=100 and this is the value I would like to export as an output for labview (right side of Node) for whatever value in the input (i put 50 for input dose). In the current code, the same value of input dose (50) is passed to the output (i assume it has to do with the reference ?). The idea is that variables dose and rate should be set/calculated in the DLL function. 
    Thank you!
    Attachments:
    DoseDLL3.cpp ‏1 KB
    DoseDLL.vi ‏8 KB

  • 11gr1 - Handling different screen resolutions for an enterprise app.

    Hi,
    We are developing an enterprise application that will be deployed at different clients with different hardware.
    We are confused about how to handle different screen resolutions and wonder how others are handling this.
    We have some fixed size areas in our screens and liquid areas for content that may expand. The problem is say that you have a table with 6 columns. This table will be rendered nicely at 1280X800 but not at 1650X1050 or 800X600.
    At higher resolutions we will either end up having some blank space or expand one of the columns of the table , but can't expand every column proportionally and this will look ugly.
    For lower resolutions same problem in a different way will come into picture, we will not able to resize the columns and end up with scroll bars etc ...
    What is the best practice with handling different screen resolutions for components like table,panel splitter etc ?
    Thanks

    Hi Muhammed,
    I don't think that any better solution exists, you already use liquid layouts and define widths & heights with percentages etc. In my opinion using blank column at the end of table columns makes table's looking better. Additionally creating custom skin for table and defining column heights & widths with % or em may help you to stretch columns?

  • Type librarys for DLL functions that TestStand understands for parameter information

    Using the C/C++ DLL call adapter I would like to specify a call to a DLL function and have TestStand (3) understand the parameter information.
    Usually it says 'there is no parameter information available'. Today however I tried building a DLL in Visual C++ instead of CVI and got a bit further. TestStand recognized that there WAS parameter type information but then said 'The type library for this DLL does not contain enough information to determine whether this function parameter is a pointer to a single item, or an array of items."
    So in a nutshell, does anyone know what options (in CVI or MSVC) I need to build with so that TestStand recognizes the function prototypes exported in the DLL? After all it's alot of work to type in all that parameter information.
    Many thanks,
    Ronnie
    TestStand 4.2.1, LabVIEW 2009, LabWindows/CVI 2009

    In CVI, you can get the parameter information into a DLL. First of all, you have to have a function panel (.fp) file with all of your exported functions defined as function panels. From this function panel file you can also generate a windows help file to document your DLL. Once you have the .fp file and .hlp file, you can enable references to them in the build target settings (Build->Target Settings...). Select "Type Library..." and check "Add type library resource to DLL" and "include links to help file" then browse to your .fp file. If there are descepencies between the functions defined in your .fp file and the actual functions you have exported in the DLL, then you may get a compiler error.
    --Peter

  • Wrapper for invoking external DLL-function

    I want to run a Host-Command (e.g. rwrun60 report=xyz.rdf batch=yes) invoked by a trigger that fires when a new record is inserted.
    I wrote a DLL which has an exported function that accepts a commandline (with parameters) and invokes the command via ShellExecute.
    The problem is, that when i invoke the PL/SQL-wrapper, the DLL-function is properly run, but the program i want to run is only visible in the taskmanager(NT) and does nothing.
    So what i need is a correct wrapper for the function:
    DLL-function: OExecSysCmd(cmdLine *char)
    Wrapper:
    PROCEDURE OExecSysCmd(p_SysCmd in char)
    IS EXTERNAL
    NAME "OExecSysCmd"
    LIBRARY demolib;
    Thanks in advance
    Dannys

    Hi Russ,
    with "invoke an external dll" I mean that I have to wite a log file to register my fdk client events and to do this I have to use an external dll wich exposes some functions to write to a common log file. I have imported the external dll in my client project and at the beginning of client code I have included the dll header file:
    #include "LogDll.h"
    Then I've tried to invoke a LogDll function (not within F_ApiInitialize (), but in a custom dialog box event):
    int retval=LogDllFunction();
    The code compiles, but if I start FM, I receive the message error. If I comment the line above, FM and my client start normally.
    Thanks,
    Stefano

  • How to auto-detect a baud rate on UART or Serial port. and how to handle different baud rates for Transmission and Reception

    Hi,
    Till now i have used only single baud rate for opening a port, writing some stuff and reading back from other end.  This time requirement is little different, can SerialPort class
    be used to have different baud rates for Tx and Rx, I have not seen that in the msdn, but any other ideas also welcome!!!. I am experimenting!!!

    When I look in the Info.plist file for the AppleUSBCDCDriver kext, which is what the driver should be for a USB modem, there are three driver personalities listed: DeviceClass = 2, DeviceProtocol = 0, DeviceSubClass = 0; DeviceClass = 2, DeviceProtocol = 0, DeviceSubClass = 2; DeviceClass = 2, DeviceProtocol = 1, DeviceSubClass = 2. When I look at the info for the Phone with USB Prober, the class, protocol and subclass are all 0 and it is assigned to the AppleUSBComposite driver which appears to be a default when it doesn't know what else to use.
    Does that information come from the phone or is it assigned by the Mac? I'm wondering if the Mac doesn't recognize the phone and is assigning default values, or if the phone is responding with the wrong values causing it not to be assigned to the right driver. Are there other USB utilities out there which could possibly configure the phone's USB port to identify itself correctly?

  • When to call DSDisposeHandle when you have a DLL function acting as a repeating DS dynamic data source?

    Hi 
    I have a DLL function acting as a dynamic data source within a LabVIEW application (see attachment) - I am using DSNewHandle to dynamically allocate 2D array handle storage via the LV memory manager for the arbitrary size data arrays to be passed into the application. I had assumed that these memory blocks would (magically) be disposed when appropriate by the LabVIEW built in processing blocks that sit downstream, however this is not the case and the LabVIEW system memory usage keeps increasing until LabVIEW environment is exited (not simply if just the offending application is stopped or closed).
    So my question is how and where to mop up the used up array buffers in the application processing chain and how do I know when the buffers are actually exhausted and not being reused downstream (for instance the two 2D arrays are first combined into a complex 2D array by the re+im to complex labview operator - is the data memory out of this stage totally different from the inputs or is it some modified version of the input arrays - if totally different and the input 2D arrays are not wired into any other blocks why does the operator not dispose the input data stores?)
    Perhaps Im going about this the wrong way having the DLL data source dynamically allocate the data space arrays? Any advice would be gratefully received
    Regards
    Steve
    Solved!
    Go to Solution.
    Attachments:
    DataGetFloat.PNG ‏23 KB

    Then instead of doing:
    DLLEXPORT int32_t DataGetFloatDll(... , Array2DFloat ***p_samples_2d_i, ...)
    if ( p_samples_2d_i )
    // *p_samples_2d_i can be non NULL, because of performance optimization where LabVIEW will pass in the same handle
    // that you returned in a previous call from this function, unless some other LabVIEW diagram took ownership of the handle.
    // Your C code can't really take ownership of the handle, it owns the handle for the duration of the function call and either
    // has to pass it back or deallocate it (and if you deallocate it you better NULL out the handle before returning from the
    // function or return a different newly allocated handle. A NULL handle for an array is valid and treated as empty array.
    *p_samples_2d_i = (Array2DFloat **) DSNewHandle( ( sizeof(int32_t) * 2 ) + ( sizeof(float) * channel_count * sample_count ) );
    // Generally you should first try to insert the data into the array before adjusting the size
    // the most safe would be to adjust the size after filling in the data if the array gets bigger in respect to the passed in array
    // and do the opposite if the adjusted handle happened to get smaller. This is only really important though if your C code can
    // bail out of the code path because of error conditions between adjusting the handle size and adjusting the array sizes.
    // You should definitely avoid to return from this function with the array dimensions indicating a bigger size than what the
    // handle really is allocated for, which can happen if the array was resized to a smaller size and you then return because of errors
    // before adjusting the dimension sizes in the array.
    (**p_samples_2d_i)->Rows = channel_count;
    (**p_samples_2d_i)->Columns = sample_count;
     you should be doing:
    DLLEXPORT int32_t DataGetFloatDll(... , Array2DFloat ***p_samples_2d_i, ...)
    MgErr err = NumericArrayResize(fS /* array of singles */, 2 /* number of dims */, (UHandle*)p_samples_2d_i, channel_count * sample_count);
    if (!err)
    // Fill in the data somehow
    // Adjust the dimension sizes
    (**p_samples_2d_i)->Rows = channel_count;
    (**p_samples_2d_i)->Columns = sample_count;
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Sender ebXML Adapter for handling multiple documents

    Hi all,
    I would like to ask for input on how to implement the use of sender Seeburger ebXML channel that will send multiple documents types (CIDX ordercreate and CIDX orderchange).
    For Seeburger AS2 adapter, handling of ANSI X12 documents (EDI850 and EDI860) can be done using Generic AS2 sender and Split997 adapters, and message splitter configuration. Is there same functionality that can be used for sender Seeburger ebXML adapter for handling multiple non-ANSI X12/EDIFACT documents like CIDX OrderCreate and CIDX OrderChange?
    Thanks,
    Edward

    Hi,
    Can we hit 100 Email ids to read email using single mail adapter?
    no, you have to configure url / authentification in the adapter what is obviously different for different ids.
    Can we achieve it using standard module?
    Do we need to develop custom module to read emails from 100 mail ids?
    You don't need module, you need 100 sender channels.
    /Udo

  • How do I set a path in an executable for a DLL?

    I wrote a VI that is using a DLL in the Call Function Library Node. I set the parameters to Specify Path In Program in the node. I did this because I am distributing the VI as an executable and the path is obviously not the same as my VI. When running the VI I am using the Current VIs path, Strip Path, and then Build Path to get the directory for the DLL I am calling. It works fine for the VI. Where my problem lies is when I run it as an executable the filename.exe is being used in the build path and the DLL is then not being found. Is there a reason the .exe is acting different than the VI? What would a good solution be to fix this problem? Thanks in advance for any help.

    There's a perfectly good reason and this question gets asked about once a week from people new to the app builder. When you use the current VI's path in the development system, the path might be c:\folder\example.vi. When in a exe or dll, the path to the current VI is c:\folder\program.dll\example.vi. You need an extra strip path. You make it work in both development and the dll by using reading the App.Kind property and wiring the output to a case statement. Put the extra strip path in the run-time case.

  • Calling a dll function that as a structure

    I'm trying to call the following function with the Call library function node:
    XLstatus xlLinSetChannelParams (
    XLportHandle portHandle,
    XLaccess accessMask,
    XLlinStatPar statPar)
    The statPar parameter is a stucture which is define as follow
    typedef struct {
    unsigned int LINMode
    int baud rate;
    unsigned int LINVersion;
    unsigned int reserved;
    } XLlinStatPar;
    I used a cluster to pass the data to the function but labview is crashing everytime. The  C output of the CLFN is :
    typedef struct {
     unsigned long LinMode;
     long baudrate;
     unsigned long Linversion;
     unsigned long reserved;
     } TD1;
    long _xlLinSetChannelParams28(long portHandle, uInt64 accessMask,
     TD1 *statPar);
    Why is labview sending a pointer to the struct instead of the structure itself? Is this the cause of my problem? Any Solution?

    The CLFN ouput shown in my previous message was done with the "handle to value" parameter. As you stated, it sends a reference to the struct memory location.The problem is that i need to pass the structure value as an input and not a pointer to it (well, that's what i think the problem is). I read the various documents about CLFN and I tried the examples but they are all have function of that kind:
    returnval ExampleFunc (structPointer *struct)
    While the function in my dll is made like that
    returnval ExampleFunc (structValue struct) (see the real function in my first message)
    I included the dll and Vi and documentation for the xlLinSetChannelParams function.  The CLFN node that calls it is the fourth one (the one with a cluster as input). The first 3 CLFN are used to call the initialization function:init driver,get channel and open port.
    Attachments:
    LIN test.zip ‏130 KB

  • Receive a cluster from a dll function

    Hi,
    I have a function in a DLL which returns a C struct.  I want to know how can I receive a cluster from a CLFN?
    struct info:
    struct typedata{
    int a;
    int b;
    const char * c;
    int d;
    int e;
    }data;
    function call:
    const typedata * hostinfo(int param);
    Solved!
    Go to Solution.

    LVCoder wrote:
    Thanks a lot both of you for letting me know about my dumb assumption that 2 different processes can use the same memory space.
    Anyways, I figured out the problem with my code that was reading the double value. 
    the DLL function returns the address of the struct which has 5 elements.
    struct test {
    int a;
    int b;
    int c;
    double d;
    double e;
    suppose the address I receive is 10
    address of test->a = 10
    address of test->b = 14
    address of test->c = 18
    address of test->d = 26 // I was refering it as address 22. but I forgot that I was on a 64 bit machine and that the OS will allocate the whole memory address for a double and won't utilize the 4 bytes left in the previous memory address. 
    thanks!
    That has nothing to do with the bitness of your CPU or the OS. It is only dependent on the compiler alignment setting when you compile your DLL. Microsoft Compilers use a default alignment of 8 bytes. That means every variable or element inside a cluster will be aligned to the smaller one of either its own size or the default alignment.
    You can change the compiler alignment either with a compiler switch or an explicit #pragma iin your source code where you declare the variables or structure typedefs.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • LabVIEW call Win32 API DLL function from third party

    Hi everyone,
    I'm trying to build a LabVIEW 2010 interface on 32-bit Window XP system to configurate and communicate to an Anglient laser head through its USB expansion box. I contacted the vendor and they shared a win32 API with some dll files. I started with a function called "A55292Find", but the CLF node always pop up error 1097.I checked the MSDN to get the corresponding LabVIEW data type for CLF.
    My question is: Do I need to initialize those arguments? (How can I know the values of them if initialization is needed?)
    Could anyone help me figure out what's the problem?
    Here is what I have from API documents about this function:
    The A55292Find function returns lists of handles and board types for all the 55292 USB
    Expansion Modules connected to the system.
    A55292RC __cdecl A55292Find(
    HANDLE hBoxes[], // List of handles for the boxes found. (as Unsigned 32-bit integer numeric)
    BOARDTYPE PortABrdType[], // List of board types for slot A boards (as Unsigned 16-bit integer numeric)
    BOARDTYPE PortBBrdType[], // List of board types for slot B boards (as Unsigned 16-bit integer numeric)
    WORD *spMaxBoxes); // dimension for all of the passed arrays. (as Unsigned 16-bit integer array data pointer)
    // (function return type as Unsigned 32-bit integer numeric)
    Parameters
    HBoxes[] Array that will receive the list of HANDLES for all the 55292 boxes connected.
    PortABrdType[] An array that will receive Slot ‘A’ board type information for each 55292 box.
    PortBBrdType[] An array that will receive Slot ‘B’ board type information for each 55292 box.
    spMxBoxes Passes the maximum number of values that can be held in hBoxes, PortABrdType, and PortBBoardType arrays to the A55292Find routine and returns the actual number of boxes found
    The return value will be one of the following A55292RC return codes:
    Value Meaning
    A55292_NO_ERROR No error
    A55292_TIMEOUT Timeout accessing a shared memory
    Remarks
    This routine must be called to obtain handles and board type information used in calling all the other routines. If there are significantly more array elements than boxes, the routine will take longer to complete.
    These are the definitions: 
    typedef DWORD A55292RC; enum{A55292_NO_ERROR, A55292_HANDLE_ERROR,...}
    typeder WORD BOARDTYPE; enum{A55292_PCAL_BOARD, A55292_NO_BOARD, ...}
    Thanks a lot,
    Kang
    Solved!
    Go to Solution.
    Attachments:
    call A55292Find.vi ‏10 KB

    nkang11 wrote:
    Hi Mr. Kalbermatter,
    As you told me, I should try to use the defined enumeration words as control and indicator.
    For the previous CLF node, it successfully returned the hardware configuration (I have only connected a board at slot A):
    But I really want to see a string return as "A55292_PCAL_BOARD" which is defined by "typedef WORD BOARDTYPE; enumeration {...}; Does that mean I need to change the data type or do something like "converter"? Or initialize the array first, then convert it to string type?
    Right now, I'm trying to open the laser card by using "A55292PcalOpen(HANDLE hDev, SLOTSELECT SlotSelector);" function which requires to use the enumeration constants from " typedef WORD SLOTSELECT; enum {A55292_PORT_A, A55292_PORT_B};" but I'm confused to shot an constant control to a new CLF node.
    Since almost all of the arguments in dll function are typedefined as WORD, short and struct et al, I hope you could give me some hints on it.
    Thank you very much sincerely!
    Kang
    Depending on the actual C implementation you can simply create a LabVIEW enum with the according item names or use a ring control instead. Teh enum requires the numeric values of the items to be in consecutive order without any gaps in between. This is a given if the C definition never assigns a specific number to the item. If the C enum is not consecutive you need to go with a ring control instead.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

Maybe you are looking for

  • 2012 iMac with gtx680mx want beta drivers?

    I just got my new iMac i7 with the gtx680mx video card.  I know there is beta drivers out for he card that improve it a little bit. Where can I download them. Thx a lot

  • RMAN temporary files in TEMP folder (e.g. rmanEPPDBT3.1179270528)

    Hi, When making a (cold) backup with RMAN, it creates a folder D:\TEMP and creates here files like rmanEPPDBT3.1178237439. - Does anybody know where these files are used for? - Can they be deleted? - Is there an option the relocate the D:\TEMP folder

  • DVD format specs in iDVD 9

    I need to make a DVD master to send to a duplication company. They require UDF, UDF Bridge, or ISO 9660 format. Images must be written in DDP2.0, DDP2.1 or CMF format with DDP prefered. I can supply them either a DVD-R either single layer DVD5 or dou

  • How do i transfer photos from my old ipad1 to my ipad mini?

    how do I transfer photos from my old ipad1 to my new ipad mini?

  • Disk size: 4.0 vs 4.7

    My dvd disks say that they are 4.7G but iDVD will only write 4.0G to them. Is there any way I can use the 0.7G??? -Jake