LabVIEW exception on 'shutdown' - unloading/cleanup of wrapper DLL

Ok, I want to check that my thinking on this is correct:
We've created a wrapper DLL in VC++ that exposes some functions from a third party API/DLL. This works fine - there's an initialise, get data and close VI that use the CLFN . There is one small problem with the wrapper though - if the 'close' VI isn't called (which calls the API's close function) such as if we have to abort the application during development/debugging then LabVIEW crashes with an exception.
I suspect that it's because the 'close' function from the API never gets called so it never cleans up when execution stops. Is that right?
Is the solution to modify the wrapper DLL DllMain() to have the following and handle the DLL_PROCESS_DETACH by calling the API's close function? Is there anything more that I need to be aware of?
BOOL WINAPI DllMain(
HINSTANCEhinstDLL, // handle to DLL module
DWORD fdwReason, // reason for calling function
LPVOID lpReserved ) // reserved
// Perform actions based on the reason for calling.
switch( fdwReason )
case DLL_PROCESS_ATTACH:
// Initialize once for each new process.
// Return FALSE to fail DLL load.
break;
case DLL_THREAD_ATTACH:
// Do thread-specific initialization.
break;
case DLL_THREAD_DETACH:
// Do thread-specific cleanup.
break;
case DLL_PROCESS_DETACH:
// Perform any necessary cleanup.
break;
return TRUE;
The original DllMain looked like this:
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved )
return TRUE;
(Taken from here: http://www.ni.com/white-paper/3056/en/)
Certified LabVIEW Architect, Certified TestStand Developer
NI Days (and A&DF): 2010, 2011, 2013, 2014
NI Week: 2012, 2014
Knowledgeable in all things Giant Tetris and WebSockets
Solved!
Go to Solution.

Stupidly, because I was having problems with Visual Studio I couldn't try it at the time of posting but changing the DllMain function worked and we no longer get the LabVIEW exception on exit.
Certified LabVIEW Architect, Certified TestStand Developer
NI Days (and A&DF): 2010, 2011, 2013, 2014
NI Week: 2012, 2014
Knowledgeable in all things Giant Tetris and WebSockets

Similar Messages

  • Exception on shutdown

    WL60
              I am deploying an EAR with an EJB jar an a single WAR
              containing a servlet. When I shut down using the console
              app I get the following exception and was wondering if
              it's due to a misbehaving servlet or a problem with
              console or something else.
              <Feb 2, 2001 11:42:07 AM CST> <Error> <HTTP> <[WebAppServletContext(3216327,console)] exception
              raised on '/console/panels/mbean/Server.jsp'
              javax.servlet.ServletException: runtime failure in custom tag 'content'
              at weblogic.management.console.pages._panels._mbean._server._jspService(_server.java:9798)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:208)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1127)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1529)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              >
              <Feb 2, 2001 11:42:07 AM CST> <Error> <HTTP> <[WebAppServletContext(3216327,console)] Root cause of
              ServletException
              java.net.SocketException: Connection reset by peer: socket write error
              at java.net.SocketOutputStream.socketWrite(Native Method)
              at java.net.SocketOutputStream.write(SocketOutputStream.java:83)
              at weblogic.servlet.internal.ChunkUtils.writeHeaderChunk(ChunkUtils.java:127)
              at weblogic.servlet.internal.ResponseHeaders.writeHeaders(ResponseHeaders.java:345)
              at weblogic.servlet.internal.ServletResponseImpl.writeHeaders(ServletResponseImpl.java:683)
              at weblogic.servlet.internal.ServletOutputStreamImpl.flush(ServletOutputStreamImpl.java:124)
              at
              weblogic.servlet.internal.ServletOutputStreamImpl.flushWithCheck(ServletOutputStreamImpl.java:451)
              at weblogic.servlet.internal.ServletOutputStreamImpl.print(ServletOutputStreamImpl.java:243)
              at javax.servlet.ServletOutputStream.println(ServletOutputStream.java:286)
              at weblogic.servlet.jsp.JspWriterImpl.println(JspWriterImpl.java:204)
              at weblogic.management.console.pages._common._requestinfo.print(_requestinfo.java:68)
              at weblogic.management.console.pages._common._requestinfo._jspService(_requestinfo.java:224)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:208)
              at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:249)
              at weblogic.servlet.internal.RequestDispatcherImpl.include(RequestDispatcherImpl.java:167)
              at weblogic.servlet.jsp.PageContextImpl.include(PageContextImpl.java:104)
              at weblogic.management.console.pages._common._error._jspService(_error.java:162)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:208)
              at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:149)
              at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:100)
              at weblogic.management.console.pages._panels._mbean._server._jspService(_server.java:9830)
              at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
              at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:208)
              at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:1127)
              at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:1529)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:137)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              thanks for your time.
              

    Stupidly, because I was having problems with Visual Studio I couldn't try it at the time of posting but changing the DllMain function worked and we no longer get the LabVIEW exception on exit.
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets

  • How to link a wrapper DLL to the target DLL

    I appreciate your help!
    Question:
    In my project, I need to deal with a hybrid programming of C++ and Labview. The C++ part has been encoded into a DLL, which aims to do a complex mathematics. The main function in the DLL has the following form:
                              float RateEqCalculate(class CLaserPulse *Pulse, class CMaterial *Material, class CThresh *ThreshPara, class CRateResults &r);
    The four arguments are all of the class type. The first three arguments are used to input parameters to the function and the last one is used to record the process of computation. For example: class CLaserPulse is composed by several numerics and two functions as the following form:
    class CLaserPulse
    public:
     float fDuration;  
     float fWave;  
     float fNA;   
     float fRefrIndex;                                     // Refractive Index
     float fAbsCoeff;                                     // Absorption coefficient [1/m]
     CLaserPulse();
     virtual ~CLaserPulse();
     virtual double Shape(double dTime);       // gives Temporal Shape
     float SpotDiameter();                            // Calculate Spotdiameter
    As in labview "class" cannot be accepted as an argument of the "Library Function Node" directly, a wrapper DLL is required to translate the "class" to the type labview can understand. The following link is a good illustration of this process. http://labviewwiki.org/DLL/shared_library Given the argument class CLaserPulse has been converted into the wrapper DLL by the method from the link, how can I later link this wrapper DLL to the target DLL. My understanding is like this:
                                                                                                 Target DLL
                                                                                    float RateEqCalculate(
      class CLaserPulse  ->   wrapper DLL       .........linking.........        class CLaserPulse,
      class CMaterial      ->   wrapper DLL       .........linking.........        class CMaterial,
      class CThresh        ->   wrapper DLL       .........linking.........        class CThresh ,
      class CRateResults  ->   wrapper DLL     .........linking.........        class CRateResults );
    Am I right? Four wrapper DLL to four class type arguments?
    Many thanks!!!

    Hello Rolf and Christian: 
    Thank you for your suggestions! I'm now working on it. I appreciate your continuous help!! 
    I'll briefly summarize my question here:
    In the original DLL, which is compiled by VC++ 6.0 and named RateEquation.dll, three class types (CLaserPulse, CMaterial& CThresh) are inclueded to do parameter exchanges; one class type is designed to save the calculation results(CRateResults);one main function to do the calculation and save the results as following form:  
     float RateEqCalculate(class CLaserPulse*, class CMaterial*, class CThresh*, class CRateResults &r); 
    My question now is the initialization of the struct type and the communication between this type with labview. 
    I'll take class CMaterial as an example to show how I made it into wrapper DLL.Original class CMaterial is defined as following:
    class CMaterial
    public:
     float AbsorberGap;
     float BandGap;
     float CollTime;
     float ElDensity; float RefractiveIndex; 
     float AbsorptionCoeff;  
     float MoleculeMass;  
     float Density;  
     float HeatCapacity;  
     float HeatConductivity;  float TAmbient;  
     CMaterial();
     virtual ~CMaterial();
      In a wrapper dll it's like this: 
    WrapperDll.h
     extern "C" { /*using a C compiler*/            //Using a C compiler to write the wrapper DLL
    #endif 
    struct RATEEQUATION_API CMaterial{                  
      //Electronical properties
      float AbsorberGap;
      float BandGap;
      float CollTime;
      float ElDensity;
      //Optical properties
      float RefractiveIndex;
      float AbsorptionCoeff;
      //Other properties
      float MoleculeMass;
      float Density;
      float HeatCapacity;
      float HeatConductivity;
      float TAmbient;
      typedef struct CMaterial CMaterial;                                             /* make the class opaque to the wrapper*/
     RATEEQUATION_API CMaterial* creat_CMaterial(void);           
    RATEEQUATION_API void destroy_CMaterial(CMaterial* LV_ref);
    #ifdef __cplusplus
    #endif  
    WrapperDll.cpp
    RATEEQUATION_API CMaterial* creat_CMaterial(void)
           return new CMaterial();                              
    RATEEQUATION_API void destroy_CMaterial(CMaterial* LV_ref)
           delete LV_ref;
     In function creat_CMaterial(), one can see the constructor of class CMaterial is called. As struct type CMaterial has the same memory layout as class type CMaterial, so it’s safe and possible to return a class CMaterial* to struct CMaterial* and it’s initialized by the default values in the class constructor. Now I’m confused by how one communicates between labview and struct CMaterial. For example, if I would like to change the parameter _CMaterial-> BandGap=6.5eV to 8eV. How to make it? My feeling is I need a cluster type from Labview as an input in the function creat_CMaterial:
                              CMaterial* creat_CMaterial(cluster_LV*)
    Many thanks!
    Message Edited by Kuo on 09-15-2009 09:56 AM
    Message Edited by Kuo on 09-15-2009 09:59 AM

  • WEBUTIL_C_API: Writing wrapper DLL's to address calling convention issues

    I am interested in calling the Windows API using WEBUTIL_C_API. In particularly, I am interested in calling FindWindow to obtain window handles. I registered the function as required, but have yet to get a meaningful result. Upon researching Metalink a bit, I encountered a post stating that FindWindow uses Pascal calling conventions, while WEBUTIL_C_API expects C calling conventions. The suggested solution is to wrap the API call in my own DLL, which adapts between the two calling conventions.
    I'm fairly adept at writing standard C code, albeit out of practice, and with a bit of Googling, I have even managed to compile a DLL using GNU gcc. Alas, I evidently don't understand all the compiler directives required to write the wrapper DLL that I have described. Has anyone else managed a similar task, who might share an example or direct me to some helpful documentation?
    Thanks,
    Eric Adamson
    Lansing, Michigan

    Mr. Ronald,
    Thank you for your assistance. After going through the webutil log file and the WebUtil Familiarization Manual a few more times, and lastly, metalink, it was stated in a metalink post that the "Cause for the Error WUC-20 can be that the webutil.cfg file has an invalid virtual directory: install.syslib.location".
    According the WebUtil Familiarization Manual (p.11 of 49), install.syslib.location=/webutil. I did just that, and the log file indicated that
    xxx.xxx.xxx.xxx:xxxxxxx: 2004-Jan-22 11:32:53.746 WUI[setProperty()] Setting property WUC_GET_LOCAL_PROPERTY to syslib.ffisamp.dll
    xxx.xxx.xxx.xxx:xxxxxxx: 2004-Jan-22 11:32:53.761 WUI[getProperty()] Getting property WUC_GET_LOCAL_PROPERTY
    xxx.xxx.xxx.xxx:xxxxxxx: 2004-Jan-22 11:32:53.761 WUI[loadSettings()] No local properties file to load
    xxx.xxx.xxx.xxx:xxxxxxx: 2004-Jan-22 11:32:53.761 WUI[getProperty()] Value of WUC_GET_LOCAL_PROPERTY=null
    xxx.xxx.xxx.xxx:xxxxxxx: 2004-Jan-22 11:32:53.777 WUI[setProperty()] Setting property WUC_URL_DOWNLOAD to 1|40960|Y|/webutil/ffisamp.dll|ffisamp.dll|WebUtil Install|Downloading required libraries; Please wait...|ffisamp.dll
    xxx.xxx.xxx.xxx:xxxxxxx: 2004-Jan-22 11:32:53.777 WUI[getProperty()] Getting property WUC_URL_DOWNLOAD
    xxx.xxx.xxx.xxx:xxxxxxx: 2004-Jan-22 11:32:53.777 WUI[downloadFromURL()] Source is http://<machine_name:port>/forms90/f90servlet/webutil/ffisamp.dll
    So I tried the absolute URL, http://<machine_name:port>/forms90/webutil, Voila! It worked. The point is somehow, the download url should not include .../f90servlet/...; just plain /forms90/webutil.
    Thank you for your time and assistance.
    Regards,
    thomas

  • Tool for generating JNI Wrapper DLL

    Hi,
    In my project I need to access methods from third party C++ DLL using JNI.
    For that I will have to write a JNI Wrapper DLL.
    I am a java programmer and have no idea about C++ programming and creating DLLs.
    Is there any tool available that can generate wrapper DLL for me out of that third party DLL?
    Thanks
    -Pragati

    Hi
    I am working on JNI Implementaion.
    Please help me out in generating the DLL file using VC++.
    I am able to successfully compile the file and able to generate the lib files but it is not generating the DLL file.
    Can you please check this once.
    Displaying the following message.
    --------------------Configuration: ikmp2lib - Win32 Release--------------------
    Compiling...
    ikmp2Lib1.c
    IKMP_lib.c
    Linking...
    Microsoft (R) Incremental Linker Version 6.00.8168
    Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
    kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib D:\DecevalJNI\ikmp2lib\Release\ikmp2Lib1.obj D:\DecevalJNI\ikmp2lib\Release\IKMP_lib.obj D:\DecevalJNI\ikmp2
    lib\Release\IKMP_callback.obj c:\forte\install\lib\qqsm.lib c:\forte\install\lib\qqfo.lib c:\forte\install\lib\qqdo.lib c:\forte\install\lib\qqcm.lib c:\forte\install\lib\qqkn.lib kmpapi32.lib OLDNAMES.LIB OLDNAMES.LIB KERNEL32.LIB USER32.LIB GDI32.
    LIB WINSPOOL.LIB COMDLG32.LIB SHELL32.LIB WSOCK32.LIB NETAPI32.LIB WINMM.LIB ADVAPI32.LIB
    Creating library ikmp2Lib1.lib and object ikmp2Lib1.exp
    ikmp2lib.dll - 0 error(s), 0 warning(s)
    Thanks and Regards
    Chatrapathi

  • NISE virtual device causes LabVIEW exception error

    I can't delete a virtual device because when selected it causes an exception error in LabVIEW. I'm running MAX 4.1 with DAQmx8.3. Do I need to uninstall everything and then reinstall to correct this error?
    kph

    Okay here is what I remember...
    I had MAX 4.0 installed on the computer (not sure of the DAXmx version but probably 8.1) and I went to export a NISE virtual device to a network drive. At that time MAX froze up and I had to kill it with task manager. When I reopened MAX the virtual device gave me a LabVIEW error when I selected it. I was able to rename it and replace it with a backed up version. I then went to delete it but MAX continued to lock up. I read in the discussion forums about the export to network drive issue and the fix with MAX 4.1 so I downloaded DAQmx 8.3 with MAX 4.1 and installed it. Afterwards MAX seemed more stable but I still get the LabVIEW error when I try to select the renamed (broken) virtual device. Also since this started I've been getting weird exception errors when I run my TestStand/LabVIEW code.
    Any help will be greatly appreciated.
    kph

  • TestStand don't unload handle in a DLL after step is executed and unloaded

    Hi,
    Sorry for the 'Google' English. I hope you can understand my problem.
    I developed a DLL (in C, under Visual C++.NET 2003) to program board by Ethernet. Then I developed VIs (LV 7.1) for this DLL. It's work very well.
    I adapted these VIs for TestStand 2.0.1 (Test Data indicator and Input buffer command - with the good connector). I had sometime error -18002 (Server close VI) then I configured steps so that TS load them dynamically and unload after the steps execution.
    With this step configuration, I can unloaded an Access file opened in a VI.
    In the DLL, I open another ASCII file then I close it before go back under LabVIEW. When I launch the VIs without using TestStand ('Edit code' and run under LV), I can launch the programming several times. But if I use 'Run selected step', I can launch only one programming: the file can't be open any more (handle already used). If I do 'run selected step' several times (4 to 5 times), I have an error -18002 and I must close LabVIEW and TestStand for all to free. I tested on another PC which works very well but there too I have the same problem.
    How do I have to configure TestStand to be sure that it releases the resource? Thank you in advance for your help.
    My NI login didn't work since many months (thanks Laura F. of ni.com to solve this problem) so I posted this message on NI France (SR 7158216). Today, they did not find a solution yet. The support tested the call of a DLL (opening/closing of a file) CVI directly under TestStand without problem. They must test the call of the DLL in one VI, called under TestStand. If somebody encountered already this problem and found a solution, that interests me because my customer want now to have his program speedly. Thanks a lot.
    Regards.
    PS:
    If that can help somebody:  LabVIEW does not like 'BOOL' and 'u_char' types in a DLL: the DLL works without error but the result is bad. It is to better use 'int' (instead of 'BOOL') and 'unsigned char' (instead of 'u_char') even of they are used in an internal function with the DLL. I must search a long time before understand this problem.

    Thanks for your answer
    .NIDays2008 {font-family:Arial, Helvetica, sans-serif; font-size:12px; color: #065fa3; font-weight: bold; text-decoration: none; text-align: right;} .NIDays2008 a, a:hover {text-decoration: none;} .NIDays2008 a img {height: 0; width: 0; border-width: 0;} .NIDays2008 a:hover img {position: absolute; height: 90px; width: 728px; margin-left: -728px; margin-top:-12px;}
    >> Avez-vous entendu parler de NI Days ?

  • More than 1 ms MOMO digital IO 7358 in LabView Real-Time 8.5, error downloading EPOS dll file into RT

    Hi all,
    I have several problems here, I tried to google but still I could not solve the problem.
    Here are my questions:
    1. I tried to download an example program of EPOS which require to download a DLL file into the RT, but it failed, here's the error (I attached the picture) 01/02/2008 13:29:50.511 [error] LabVIEW:
    Failed to load shared library EposCmd.dll:_VCS_GetProtocolStackName@16:C on RT target device.
    From the NI.com forum,
    I found a similar problem and it said by installing Network Variable Engine and Variable Client Support into the LV-RT, and I did, but still failed. Any one can help me about this?
    2. I posted a question also in lavag, I think this section is more appropriate. "I
    am trying to use the digital IO of the motion controller of 7358, but then I realized the delay is more that 1 ms (I checked using the oscilloscope), I attached the code (MOMO = Must On Must Off). Is this real, I mean the hardware delay between on-off is as big as this? Anyone knows the solution for this?"
    Note: I am using LV-RT 8.5, PXI-7358 Motion Controller, EPOS 70/10
    Thank you for any help
    Message Edited by bono02 on 01-02-2008 05:47 AM
    Attachments:
    maxon-rt3.JPG ‏120 KB
    momo1.JPG ‏55 KB

    Hello bono,
    1.  From what I have seen, this error is usually caused by one of two things.  The first is the Shared Variable software components not being installed, which is covered in this Knowledgebase.  The other is due to a corruption of the ni-rt.ini file on the Real-Time controller.  You can follow the steps layed out in this Knowledgebase, which gives three possible remedies.  You could also try reinstalling the software (firmware) or create a PXI Uninstall disk from Measurement & Automation Explorer by selecting Tools»Remote Systems»RT PXI Disk Utilities»Create PXI Uninstall Disk.  Boot the PXI Controller from the PXI Uninstall Disk, which will erase the ni-rt.ini and ph_exec.exe on the target.  However, you will need to reconfigure the controller after doing this.
    2.  Due to the nature of the digital I/O on motion controllers, it is not surprising that you are seeing around a 1ms delay.  It deals with the fact that it must update the motion controller with the new value on each control loop.  This Knowledgebase gives a little more clarification regarding the 7350 specs.
    Carlton
    CLD

  • Copying the PKCS#11 wrapper dll to the client machine in a signed applet

    Hello,
    I'm implementing in a signed Java Applet using the IAIK PKCS#11 Wrapper and the PKCS#11 module of my hardware token to communicate with it.
    I have to copy the pkcs11wrapper.dll to the client machine. All things works perfectly under Windows XP but when the client have Windows Vista as OS, it's not possible to copy the needed dll.
    Thank You for any help
    Nizar

    Use JNLP for this.

  • Have anyone used Labview to call MSP430_Memory function in the MSP430.dll?

    Hi,
    I am trying to read data from Infromation Memory of a MSP430 MCU. I am using MPS-FET430UIF to communicate with the MCU and having trouble to get data using the function MSP430_Memory. Have anyone done this before? I greatly appreciate any help from this forum.

    Good Afternoon,
    I just have a couple of quick questions for you:
    How are you going about calling the dll in LabVIEW?
    Are you using the call library function node?
    Could you post your code so we can take a look at it and get a better idea how you are going about it?
    I hope you have a great rest of the day!
    -Cody C

  • I'm trying to access Window Handle (HWND) in Labview. This is an argument of a DLL. Also I need to get a pointer of an image buffer.

    Call library function in Labview:
    =================================
    Hi all,
    I'm trying to access a DLL using Call library function in Labview.
    1) I have problems in obtaining the window handle (hDC) of an object in Labview.
    2) Also to get the pointer of an image buffer.
    thanks
    Code Warrior
    Take life as it comes! you may never know what's gonna happen Tommorrow

    Bob Y. wrote:
    I'm trying to do something similar right now and coming to the same problems. I am trying to get the image from a Nikon DXM1200 camera that is mounted on a microscope. It has its own commands and capture card and is not playing well with the imaq stuff. I am using their SDK in an effort to get the images into LabVIEW.
    As I said, I am having the same types of problems. I managed to wrap everying into a dll and into a .net assembley, but I have been unable to figure out a way to get it into LabVIEW. I can call either of these things from LabVIEW to make an image capture. But, I have been unable to transfer that image into LabVIEW. I also have been unable to get enough windowing information to get the information into LabVIEW.
    I am not sure what Code Warrior is doing, but here is why I have been tracking this thread with great interest.
    Thanks for the thread,
    Bob
    You might want to look at http://www.hytekautomation.com/products.html. They have a Nikon interface for LabVIEW and since you already have the SDK, the issue mentioned on their site won't be a problem for you. It is for sure much more cost effective to pay them some money for that interface than trying to develop an interface yourself. The issues are quite involved and even if you knew quite some stuff about LabVIEW memory management and its internal C programming interface (and you can get quite some information from looking at the NI-IMAQ VIs too, eventhough they are anything but a nice example for good programming style), it is a work counting into weeks to get it done right.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Labview 7 crashes when a vi containing a dll is closed

    Dear All,
    I've written a dll in C language to use a USB dongle. Before making my
    C code into a dll, I throughly tested it as a console application,
    using Borland C++.
    In Labview, I call my dll, using the call library function node. The
    first time I run my program, it does what I expect with the dll. If I
    try to run it again, it doesn't work. I found a program on the
    internet, called listdll, which displays the dlls that are currently
    loaded in memory. The dll that I wrote as well as the other dlls that
    this function uses (loaded statically), appear in the list.
    To get my program to run properly once again, I need to shut down
    labview and open it up again. However when I shut down Labview, I get a
    Labview-Application Error message, that says that the instruction at
    "0x06b323d1" referenced memory at "0x06b323d1". The memory could not be
    "read".
    How can I possibly get around this problem and how can I run my program
    several times without shutting Labview down in the meantime?
    My Labview program was written in Labview 7, but if needed be, I've
    also access to LAbview 8.
    Thanks in advance for your help,
    Regards,
    Alan

    Hi Alan,
    LabVIEW pre-allocates memory for calls to DLL's, if the DLL's goes over the memory allocation this can cause problems such as a LabVIEW crash.  Are any of the parameters arrays or strings?
    Regards
    Jon B
    Applications Engineer
    NI UK & Ireland

  • Failed to unload classloader once loaded dll.

    This is yet another 'unload dll' topic.
    I badly need unload a dll. As adviced by many threads, i created custom classloader - once it is gc-ed it should unload it's native libs.
    Classloader works fine and is gc-ed fine - as long i do not call a method from dll.
    Once a dll method is called, the classloader is never gc-ed (PhantomReference to it is never enqueued).
    i use jre 1.5_09 on windows xp.
    the method called from dll is static, has no args, does not use JNIEnv or jclass and just returns a zero.
    Please, any ideas?

    i solved the problem. it just works + i learned one lesson:
    - never put a breakpoint into class you would like to unload :-)
    bye, martin

  • Labview 5.1 vs. 5.0 and dll calls

    Hello!
    I have Analogic cPCI-14-2 DAQ cards in the PXI box. Their driver is a dll
    for which I wrote LabView interface using LV5.01 . Everything was nice
    until I switched to 5.1, now it is impossible to run the program for more
    than 5min without a memory access violation error and subsequent LV crash.
    I compiled executable from the DAQ module under 5.01 and 5.1. Executable
    made under 5.1 would not even execute once, resulting in the crash. Then I
    saved VI's using save as LV5.0 option, compiled executable under LV5.01 and
    that runs without problems. I ended up using ActiveX server capabilities of
    the executable by calling it from my main program written using LV5.1
    because I needed to call Matlab. ActiveX server is actu
    ally nice because of
    DCOM in NT boxes, I can now run everything from my office super-duper
    machine instead of using a PXI box's Pentium233.
    Question is, has anyone else had problems with dll calls and how were they
    solved ?
    I will appreciate your suggestions.
    Sincerely
    Reinis Kanders

    Mass compiled in 8.2.1
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Keithly 8_2.zip ‏1231 KB

  • Labview driver for signal generator can not find DLL

    The labview driver "age82xx.zip" I downloaded from NI website can not find DLL "age82xx_32.dll". There is no this dll file in the zip file. Please help me. The labview version is 7.0. The instrument is Agilent E8254A. Thanks!

    On the download page, there is a link under "Require Third-Party Installation(s)". This is explained at the top of NI's page. Clicking on the link will take you to Agilent's web site where you will have to select the 'Signal Generators' link to get the E82xxA driver.

Maybe you are looking for