ViClose deadlocking in the DllMain function of a DLL

Using NI-VISA 5.2 and 5.3, attempting to viClose a Resource Manager session when processing DLL_PROCESS_DETACH in the DLLMain function of an instrument driver DLL made in Visual Studio 2010 can cause a deadlock. This did not happen with earlier NI-VISA versions. Should it be possible to clean up any outstanding Resource Manager sessions when a DLL unloads?

We found the same deadlock issue with viClose().
Ie when viClose is executed from the C++ object destrcutor of a file scope object, ie viClose(ResourceManager) when processing DLLMain's DLL_PROCESS_DETACH, which calls Microsoft's C++ runtime object cleanup code, ie calls destructors.  
The deadlock issue was discovered a few weeks ago when a customer upgraded to NI-488.2 version 3.1.1.  Luckily at the time, we were able to internally switch from using VISA to NI-488 via our hardware abstraction layer, and continue suporting the customer.  
Today, I was able to track down the customer issue to NI-VISA 5.3 and create a work arround.  ie, creating a new DLL funciton and calling it from the application before the main application calls FreeLibrary() on the DLL.
This issue doesn't happen with NI-VISA 5.2.

Similar Messages

  • Interfacing LabVIEW to the GetFileTime function in kernel32.dll

    I am attempting to get the creation date/time of a file. The GetFileTime function inside kernel32.dll seems like a good choice. It requires a handle to the file, so I open the file, typecast the refnum to a U32 and pass the U32 to the Call Library function node. The outputs I expect are pointers to strings, so I use the C string pointer.
    I am at a loss of why this doesn't work. I have my crude VI (LV7.0) attached.
    Attachments:
    Get_File_Times.zip ‏13 KB

    Hi,
    If you use GetFileTime, the handle has to be opened with:
    HFILE OpenFile(
    LPCSTR lpFileName, // file name
    LPOFSTRUCT lpReOpenBuff, // file information
    UINT uStyle // action and attributes
    LV's file handle is not compatible!
    Also, this function is tricky. lpCreationTime is not a pointer to a string,
    but a pointer to a FILETIME structure. You should provide it with pointers
    to clusters with two U32's in it. You can do this by making a cluster with
    two integers in it, and wire it (three times) to the dll. The dll has to be
    configured as "adapt to type".
    You should convert the FILETIME structures to SYSTEMTIME's with:
    BOOL FileTimeToSystemTime(
    CONST FILETIME *lpFileTime, // file time to convert
    LPSYSTEMTIME lpSystemTime
    // receives system time
    Regards,
    Wiebe.
    "Mark Borodkin" wrote in message
    news:[email protected]..
    > I am attempting to get the creation date/time of a file. The
    > GetFileTime function inside kernel32.dll seems like a good choice. It
    > requires a handle to the file, so I open the file, typecast the refnum
    > to a U32 and pass the U32 to the Call Library function node. The
    > outputs I expect are pointers to strings, so I use the C string
    > pointer.
    >
    > I am at a loss of why this doesn't work. I have my crude VI (LV7.0)
    > attached.

  • How to invoke the exported function of odbc32.dll

    Hi,
    I am unable to find the dll (SQLAllocHandle.dll) in our system. Its mentioned that the ‘SQLAllocHandle’ is one of the exported function of odbc32.dll
    I want to find out how to invoke this exported function and make use of the same in our system?
    Regards,
    Jay

    Your question leads me to believe you're not sure what you're asking.
    SQLAllocHandle is an ODBC api call, and you use it in your ODBC API program, the same way you use other ODBC api calls.
    Here's an example of a simple ODBC API program that uses SQLAllocHandle.
    Hope it helps,
    Greg
    #include "windows.h"
    #include "stdio.h"
    #include "sql.h"
    #include "sqlext.h"
    void GetSQLError();
    #define checkforerrors if (rc!=SQL_SUCCESS){GetSQLError();exit(1);}
    static      HENV     henv;
    static      HDBC     hdbc;
    void main(int argc, char *argv[])
         SQLRETURN rc=0;
         SQLCHAR* uid="SCOTT";
         SQLCHAR* pwd="tiger";
         SQLCHAR* dsn="orcl32";
         rc = SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&henv);checkforerrors
         rc = SQLSetEnvAttr(henv,  SQL_ATTR_ODBC_VERSION,(SQLPOINTER)SQL_OV_ODBC3,0);checkforerrors
         rc = SQLAllocHandle(SQL_HANDLE_DBC, henv, &hdbc);checkforerrors
         rc = SQLConnect(hdbc, dsn, (SWORD)strlen(dsn), uid,(SWORD)strlen(uid),pwd,(SWORD)strlen(pwd));checkforerrors
         printf("connected\n");
         rc = SQLDisconnect(hdbc);checkforerrors
         rc = SQLFreeConnect(hdbc);checkforerrors
         rc = SQLFreeEnv(henv);checkforerrors
    void GetSQLError()
    long    llDbErrCd = 0;
    short   llRetMsgLen = 0;
    char    lszSqlErrMsg[255];
    char    lszSqlMsg[255];
    SQLError(henv,hdbc,0,(SQLCHAR*) lszSqlErrMsg,&llDbErrCd,(SQLCHAR*) lszSqlMsg,255,&llRetMsgLen);
    printf(lszSqlErrMsg);
    printf(lszSqlMsg);
    }

  • Exported Functions of CRDersinerUI.dll

    Hi,
    I am using CRDesignerUI.dll of Crystal Reports 10.2 for Visual Studio 2005. I am unable to find the exported functions of CRDesignerUI.dll. Can anyone tell me the way to find it's exported functions and the way to create the .cpp and.h file of the dll?
    Thanks in advance.
    Edited by: MeghaB on Aug 19, 2009 8:13 AM

    You are not licensed to use the CRDesignerUI.dll or craxddrt.dll or any other components that used to be part of the Report Designer Component. With CR 10.2, you are only licensed to use the Crystal Reports SDK for .NET (CR assemblies such as crystaldecisions.crystalreports.engine.dll, etc.).
    Only with full stand-alone versions of Crystal Reports do you get the license for the RDC. However, you need to be aware of two issues:
    1) RDC has been retired in version 12 of Crystal Reports. See the [Statement of Direction|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/80bd35e5-c71d-2b10-4593-d09907d95289]
    2) The RDC was never tested with .NET and thus is not supported in .NET. You can use it, but help will be hard to come by and based on what would work on a supported platform. Further, any bugs would not be reportable to R&D unless reproduced in a supported environment.
    E.g.; I highly recommend using the CR assemblies for .NET in you applicaiton development.
    Ludek

  • Need .h file for x86 and x64 functions in clsernat.dll

    We need to bypass the NI Vision Acquisition/IMAQ serial level and access the CameraLink serial layer directly for a custom baud rate. 
    The clsernat.dll is present but cannot locate documentation for the exposed functions in clsernat.dll. NI did not include a .h file or documentation regarding the typedefs for the following functions :
    clFlushPort
    clGetErrorText
    clGetManufacturerInfo
    clGetNumBytesAvail
    clGetNumSerialPorts
    clGetNumSerialPortsAtIP
    clGetSupportedBaudRates
    clSerialClose
    clSerialInit
    clSerialRead
    clSerialWrite
    clSetBaudRate
    ( Reasoning- IMAQ will occasionally validate the camera file and change the baud rate. The end result is missmatched baud rates corrupting the serial data channel.)
    Any assistance would be appreciated.
    Steven.

    Joel,
    Appologize for the earlier typos. (Was responding through a browser on a touchscreen phone.) 
    The baud rate in this particular case is 57.6K. 
    The camera link cl serial interface will work fine all day communication at 57.6K using the MFG's test utility (when the camera file has the default baud rate of 9.6K.) The NI document which also confirms this is a viable speed for the 1428 is http://digital.ni.com/public.nsf/allkb/359CC1956ABBB6F3862575A500674FEC and 57.6K is a listed speed for the 1433 board.
    What is strange is other manufacturers provide the c++ header files, libs, and the required dll but NI only includes the dll in the IMAQ package. (Especially since NI provided an early implementation to the Camera Link working group with these files.)
    Thank you,
    Steven.

  • How to creat deadlock for the purchase order in SAP Workflow

    How to creat deadlock for the purchase order in SAP Workflow

    Hi Ben,
    Are you using FM "CONVERT_DATE_TO_EXTERNAL" before passing delivery date?  If not, use FM like this, before passing the date to BAPI_PO_CREATE1 and it might work
      DATA: vf_doc_date(10),
                 internal_date TYPE d.
         vf_doc_date = sy-datum.              "Document date.
         internal_date = vf_doc_date.
      CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
        EXPORTING
          date_internal            = internal_date
        IMPORTING
          date_external            = vf_doc_date
        EXCEPTIONS
          date_internal_is_invalid = 1
          OTHERS                   = 2.
    Regards,
    Vivek

  • The InitCVIRTE function is not listed in the NIDAQ function reference online help? Why? and where can I find a description of this function?

    the InitCVIRTE function is not listed in the NIDAQ function reference online help? Why? and what does she do?and where can I find a description of this function? Can i use this function with visualc++ 6.0?

    The InitCVIRTE function is in the CVI run time engine (cvirte.dll)..not part of NI-DAQ.
    Applications written or using CVI may call this function..
    How are you running into this ?
    From the CVI help...
    This function performs initialization of the CVI Run-Time Engine. It is needed only in executables or DLLs that are linked using an external compiler. Otherwise, it is harmless.
    It should be called in your main, WinMain, or DllMain, function. The parameter values you should pass depend on which of these three functions you are calling InitCVIRTE from. The following examples show how to use InitCVIRTE in each case.
    If you are using main, your code should be as follows.
    int main (int argc, char *argv[])
    if (InitCVIRTE (0, argv, 0) == 0)
    return -1; /* out of memory */
    /* your other code */
    return 0;
    If you are using WinMain, your code should be as follows.
    int __stdcall WinMain (HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPSTR lpszCmdLine,
    int nCmdShow)
    if (InitCVIRTE (hInstance, 0, 0) == 0)
    return -1; /* out of memory */
    /* your other code */
    return 0;
    If you are creating a DLL, you must call InitCVIRTE and CloseCVIRTE in your DllMain function, as in the following.
    int __stdcall DllMain (void *hinstDLL, int fdwReason,
    void *lpvReserved)
    if (fdwReason == DLL_PROCESS_ATTACH)
    if (InitCVIRTE (hinstDLL, 0, 0) == 0)
    return 0; /* out of memory */
    /* your other ATTACH code */
    else if (fdwReason == DLL_PROCESS_DETACH)
    /* your other DETACH code */
    CloseCVIRTE ();
    return 1;
    NOTE: The prototype for InitCVIRTE is in cvirte.h, not
    utility.h.
    NOTE: In CVI 4.0.1, this function was expanded from one to
    three parameters. Executables and DLLs that were
    created using the one-parameter version of the function
    will continue to work properly.
    /*-------------------- Prototype ---------------------*/
    int InitCVIRTE (void *HInstance, char *Argv[], void *Reserved);
    Nandan Dharwadker
    Staff Software Engineer
    Measurement Studio Hardware Team

  • Error While including the Multisite functionality

    Error While including the Multisite functionality & trying to click on SiteAdministraion tab in BCC
    Background: We have migrated our application from ATG v9.1 to ATG v 10.0.2 and implementing Multisite on the same
    Getting this error on BCC console:
    12:55:36,893 INFO [ServerImpl] JBoss (Microcontainer) [5.0.0.GA (build: SVNTag=JBPAPP_5_0_0_GA date=200910202128)] Started in 2m:44s:727ms
    12:57:24,234 ERROR [SiteAdminActivitySource] The acl for the custom workflow activity named siteadmin.manageSiteAssets is invalid. This activity will not be available.
    atg.security.InvalidPersonaException: Profile$role$siteAdminUser
    at atg.security.AccessControlListParser.setPersona(AccessControlListParser.java:239)
    at atg.security.AccessControlListParser.parseAce(AccessControlListParser.java:277)
    at atg.security.AccessControlListParser.parse(AccessControlListParser.java:193)
    Thanks in Anticipation1

    Hello Sudheer,
    Increasing the Swap space is the only thing i noticed in all SAP Notes for your problem.
    Configure more swapspace please and restart the installation.
    Regards,
    Siddhesh

  • Enabling the printing function of your HP Laserjet M1005 printer

    If you wonder how to install the printing function of your HP Laserjet M1005 printer, here is listed a bullet list of the actions. This has just been tested out thanks to the Support team from Germany
    Go to the page http://h20000.www2.hp.com/bizsupport/TechSupport/DriverDownload.jsp?prodNameId=1 839459&lang=en&cc=us&prodTypeId=18972&prodSeriesId=1839458&taskId=135 and select the link Mac OS X; download the link "HP LaserJet M1005 MFP Mac OS X Full Software Solution"
    Use the opportunity to update your printer firmware by selecting the link "Printer Firmware Update"
    Shutdown your Mac and start up in the safe boot mode (should be the combined keyboard shift and power on/off - refer to the Apple web site for details)
    Run the downloaded SW package listed in the step 1
    Go and select under system settings printer and fax, follow the step-by-step instructions to have a printer installed
    Shutdown your Mac and start up again in the safe boot mode
    Connect your printer and the printer SW installation message shoud pop up requesting you to install it
    SW download process should appear and run
    Be aware that just the printing function will be available - no scanning function so far
    For those who may be interested in knowing why safe boot mode: it is likelz that my anti-virus SW Kaspersky denied the installation.
    Continue to enjoy your HP Laserjet M1005 printer

    "For those who may be interested in knowing why safe boot mode: it is likelz that my anti-virus SW Kaspersky denied the installation."
    You should read this:
    http://www.reedcorner.net/mmg-antivirus/

  • I have just sought  to update my lightroom and am now unable to access the develop function and get a note stating that I have reduced functionality what it this about and how do I get my product back

    I have just sought  to update my lightroom and am now unable to access the develop function and get a note stating that I have reduced functionality what it this about and how do I get my product back

    Hi there
    I have version 5.7 and every time I opened it I was told that updates are available and to click on the icon to access these.  Instead it just took me to the
    adobe page with nowhere visible to update.  I then  sought to download lightroom cc and this is when I could not access the 'develop' section due to reduced
    functionality  It was apparent that my photos had been put in cc but no way to access them unless I wanted to subscribe. 
    I have since remedied the problem as  my original lightroom 5.7 icon is still available on the desktop and have gone back to that.  I do feel that this is a bit
    of a rip off and an unnecessary waste of my time though.
    Thank you for your prompt reply by the way.
    Carlo
    Message Received: May 04 2015, 04:52 PM
    From: "dj_paige" <[email protected]>
    To: "Carlo Bragagnolo" <[email protected]>
    Cc:
    Subject:  I have just sought  to update my lightroom and am now unable to access the develop function and get a note stating that I have
    reduced functionality what it this about and how do I get my product back
    dj_paige  created the discussion
    "I have just sought  to update my lightroom and am now unable to access the develop function and get a note stating that I have reduced functionality what it
    this about and how do I get my product back"
    To view the discussion, visit: https://forums.adobe.com/message/7510559#7510559
    >

  • TS3276 An email sent from my iMac has a button linked to a clip hosted on Vimeo. When received, the link functions on iMac and iPad, but opens a window of app icons on iPhone and iPod touch. Any ideas what's wrong?

    An email sent from my iMac has a button linked to a clip hosted on Vimeo. When received, the link functions on iMac and iPad, but opens a window of app icons on iPhone and iPod touch. Any ideas what's wrong?

    For anyone else reading this thread, it is worth knowing that sometimes an email is, or can be, corrupted thereby jamming the works. The solution above is good, but I just wanted to suggest another one.
    If the problem arises, go to an online mail access service, such as Mail2Web.com and login to you mail account there and delete the offending message.
    Problem solved.
    And George, as this is all entirely voluntary, whinging about no takers may not endear people to you. Besides which, a few minutes of searching on Google would have found you a number of solutions.

  • How to use the Table Function defined  in package in OWB?

    Hi,
    I defined a table function in a package. I am trying to use that in owb using Table function operator. But I came to know that, owb R1 supports only standalone table functions.
    Is there any other way to use the table function defined in a package. As like we create synonyms for functions, is there any other way to do this.
    I tryed to create synonyms, it is created. But it is showing compilation error. Finally I found that, we can't create synonyms for functions which are defined in packages.
    Any one can explain it, how to resolve this problem.
    Thank you,
    Regards
    Gowtham Sen.

    Hi Marcos,
    Thank you for reply.
    OWB R1 supports stand alone table functions. Here what I mean is, the table fucntion which is not inculded in any package is a stand alone table function.
    for example say sample_tbl_fn is a table function. It is defined as a function.It is a stand alone function. We call this fucntion as "samp_tbl_fn()";
    For exampe say sample_pkg is a package. say a function is defined in a package.
    then we call that function as sample_pkg.functionname(); This is not a stand alone function.
    I hope you understand it.
    owb supports stand alone functions.
    Here I would like to know, is there any other way to use the functions which are defined in package. While I am trying to use those functions (which are defined in package -- giving the name as packagename.functionname) it is throwing an error "Invalid object name."
    Here I would like know, is there any other way to use the table functions which are defined in a package.
    Thank you,
    Regards,
    Gowtham Sen.

  • Is there a way to specify columns to be excluded from the NLSSORT function

    Hi, in order to enable case-insensitive searches in oracle without making significant app changes, we've added a login trigger that enables linguistic sorting by setting the session params:
    alter session set nls_comp=LINGUISTIC;
    alter session set nls_sort=BINARY_CI;
    While this gives us exactly the desired behavior for all our actual linguistic data, 90% of our primary key fields are typed as varchar2 fields that contain GUIDs. This is a problem because the primary key index is a binary index but when we query for a row by its primary key, we're getting table scans because the query is being translated to using the NLSSORT function because of our session setup.
    Here's a specific example of what we're seeing:
    SQL> create table t1 (c1 varchar2(255) not null, c2 varchar2(255) null, primary key (c1));
    Table created.
    SQL> set autotrace traceonly explain;
    SQL> select * from t1 where c1='t';
    Execution Plan
    Plan hash value: 3617692013
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 258 | 2 (0)| 00:00:01 |
    |* 1 | TABLE ACCESS FULL| T1 | 1 | 258 | 2 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    1 - filter(NLSSORT("C1",'nls_sort=''BINARY_CI''')=HEXTORAW('7400') )
    Note
    - dynamic sampling used for this statement
    I understand why this is occurring and I know that if I add an NLSSORT based index to the primary key columns on each of our tables (in addition to the existing unique index used by the PK constraint) that second index will cause my query to perform an index range scan. However, for various reasons this is something of a daunting task in our app and we'd like to avoid the double indexes for performance reasons as well. So what I'd prefer to do is find a way to tell the session to NOT apply the NLSSORT function when it sees these columns in incoming SQL, but I haven't read anything that leads me to believe that such blacklisting is a feature of the NLS libraries. If anyone knows whether this is possible or not or if you have an alternate approach, I'd really appreciate your feedback.
    Thanks!
    Message was edited by:
    user616116

    Unfortunately, there is no way to avoid this problem globally. We are aware of this deficiency and we will look for a solution for some future release. In the meantime, you will need, unfortunately, to code the workaround you mentioned.
    -- Sergiusz

  • Can i upgrade my laptop's graphic card? and how does this upgrading affect the other functions?

    is it possible to upgrade my HP Split 13-m111TU x2 PC's graphic card? how does one go about this upgrading process? does it affect the other functions and features of the laptop? 

    Hi:
    The graphics adapter in your model cannot be upgraded.

  • How do I use the WriteToMemoryXX functions in a CIN?

    I'm getting a linker error "unresolved external reference _WriteToMemory16" when I compile the C code that contains the calls to the WriteToMemory16 function. I've installed the accesshw files and am including the accesshw.h file in my C-code CIN. It would seem that I need to compile-in the code for the WriteToMemory function, which I assume resides in accesshw.c.
    My application calls for some direct hardware i/o that falls in the "too messy to do in a block diagram" catagory. I'm using Labview 5.1.1 and talking to a Keithley Metrabyte PIO-96 card.
    Thanks very much for any assistance.

    Ben,
    Thank you for the response. I looked at the examples you mentioned, but unfortunately I'm still unsure what to do. As mentioned, I downloaded the accesshw.zip file and installed the files in order for me to use InPort and OutPort VIs in my program on an NT box, which I'm doing and is working fine. Also, I downloaded the example, "PCI-DIO using AccessHW_DLL.c". This C file contains calls just like the ones I want to use (calls to WriteToMemoryXX) in my CIN C code to basically do the same operations as are done by the InPort and OutPort VIs. Is there a makefile available for that C file? Maybe if I knew how to build that file into a CIN, it would be the same process for me to build my file into a CIN. There is an include file in the "PCI-DIO using AccessH
    W_DLL.c" file that I don't have (ansi_c.h), but I don't get a compiler error when not including this file in my C file so
    I assume I don't need it. I've got the accesshw.dll file in the same directory as my .c file, as instructed to do on the accesshw.zip download page.
    I'm developing the CIN using MSVC++ 4.0 if that helps.
    Thanks very much,
    Jeff

Maybe you are looking for