What is the safe way to do initialization and finalization?

Hi all

I have a thrid driver for an external to use in my CVI device. I have to initialize the driver during the initialization of the main draw and RELEASE the driver to close the application. In my code, the main structure is something like

int main (int argc, char * argv [])
{
char s [10];
If (InitCVIRTE (0, argv, 0) == 0)
Returns - 1;    / * memory * /.

Here I put the code to initialize the driver before DisplayPanel and will release the driver at the end of the main function. I am wondering if this is safe and the right way to do that? The reason why I am asking is the external driver is so strange, if the application using that not release the driver properly, other application can't use it unless to reboot the system.

I search online and see someone to release the driver in the event EVENT_CLOSE of the main panel, is that better way to do the finalization here? If so, any function like EVENT_START or EVENT_INITIALIZATION so I can do some initialization there?

Thanks.

Hi Dragondriver,

It sounds like the person used event_close in order to close out the reference to the driver if the UI is exited. This makes sense. You could include both without a problem. For example, you could initialize and close out the reference to the driver in each subprogram or subroutine you write that uses the driver, in addition to automatically closing out any references to it if the UI is closed accidentally in the middle of a subroutine. This would be a good way to do it.

Tags: NI Software

Similar Questions

  • What is the best way of updating OID and similar attributes via OIM OAM LDAP?

    Our environment uses IOM provisioning of an OID LDAP that is used by OAM.

    Purposes of inheritance, must complete the Oracle "orcl *" attributes and OAM "ob * ' in cases where they use the same or similar.

    Example: When a user is disabled in IOM we define orclisenabled = 'false' and obUserAccountControl = 'DISABLED' in OID

    What is the best way to achieve the IOM? My first thought was to write a custom adapter, similar to the OID adapter change user out-of-the-box, which takes in charge the changing multiple attributes.

    Is there a better way?

    You can create two tasks that will modify two attributes to OID.

    On the task of the user to disable call task1, success of task1, Task2 (using the task to feature generate).

    You can make use of OOTB connector only.

  • What is the best way/place to initialize everyting in my VI?

    OK LabVIEW Pros... I'm new to LabVIEW and created my first workstation (complex semi) powered by LabVIEW. In an attempt to form the best habits possible LabVIEW that I need some help. With graphical interfaces, there are always several variables and controls/indicators that must be initiailized. What is the best method to do it? It works perfectly, but seems just ugly... It would be better to throw all this in a Subvi or at that time here have I not to worry about all the references etc...? Ideas and best practice tips are needed/appreciated. See the example below...

    Thank you guys!

    Kellen

    rkmadse wrote:

    I was just using the error is to try and a GUARANTEE that these things are executed. For some reason, I thought that it was necessary, but what you're tellin me is if they are in order flat so I have really need connect the wires of the error at all and they will all run for sure before defined the while loop?

    Yes, you do not have to merge all the clusters of error, just a thread running on the while loop is good enough, as you have done. In this code snippet, the loop on the right has to wait the one on the left to complete before running. If you disconnect the terminal error however, they run them both at the same time.

  • What is the best way to organize files and folders on my mac (current Yosemite)?

    I'm bored of Windows Explorer, since I got my Mac, as the Finder does not quite do the job.  Applications or software out there who will help?

    I think you go through a learning curve, Finder is much more powerful than WE have ever been. You can benefit by using https://www.apple.com/support/macbasics/ to learn how to OS X and if it is not useful to get a book on the Mac OS X version you use and use it as a reference guide until you feel comfortable using OS X.

    As much a organize your stuff, specifically are what types of files & folders you referring? If you mean to say that your photos and then use the Photos app for this, if you want to say your music is what iTunes. If you want to tell your other files then Finder and how to organize the files and the use of items such as tags in the Finder. There is a LOT of information at your disposal, but you must write specific questions in the case that we do not know what you are trying to solve the problems.

  • What is the best way to learn photoshop and other adobe products?

    I am an amateur photographer and all my editing was done in Lightroom. I know I have a unlimited creativity with my photos in Photoshop, and so the question comes up. I would like to learn how to use product to adobe as much as possible. What would be the best option? Graphic design of decision-making in a community college, to seminars, to youtube, books, day 2 courses etc... I know Adobe Tutorials but I would like to learn as much as I can out of Adobe.  Of the suggestions as to what type of courses or classes to take would be appreciated. Thank you in advance to Adobe and the Adobe community for your help!

    No doubt personal lessons are the best (short courses and colleges) - and the most expensive!

    There are some excellent books, such as quick start Guides and classroom in a book series.

    The tutorials of Trainsimple.com and Lynda.com online video training are also very good. You can get a free 10 day trial with Lynda.com to try.

    And you can always ask specific questions on the Adobe forums.

  • What is the best way to zoom in and out of photos, documentary style?

    I am new to Adobe Premiere and I was looking for a brand, a mockumentary in which there would be a slow zoom in the photo, while the Narrator speaks. If you could imagine what I'm talking about.

    Could someone tell me how you who would accomplish?

    Thank you

    Best is to use the Point of CAPSA (in movement), it is more accurate then graphic postiton panoramic.

    http://www.YouTube.com/watch?v=tPSQQAhp3To

  • What is the right way to add a language?

    Hello
    I wanted to show traditional Chinese web pages with Chinese characters
    (for example, hk.yahoo.com).

    I walked into the tab Control Panel / regional and language options/languages
    and choose "install files for East Asian languages".   He asked for the XP CD,
    installed something and seemed to work.

    However, it seems to have turned on a few items for the language entry,
    from what I see in the boot options.  I don't want to enter the Asian languages,
    show only the Chinese web pages.

    What is the right way to set up and get rid of all this stuff related to the input method?
    (the first 4 points here)

    http://ImageShack.us/photo/my-images/341/StartupItems.jpg/

    Richard,
    I have done work similar to what I described.

    I deselected "install files for East Asian languages" as I mentioned above,.
    removed startup items which appeared in msconfig (you can see the 4 in the JPG I posted)
    and restarted.  What this does in fact, I'm not sure.
    Is it uninstalled or disabled just something, I'm not the wisest.
    (For example, the fonts themselves)

    I open IE8 and went to a page where the Chinese characters should be displayed.
    Instead of characters, the text appeared as small squares. But after playing with
    view/encoding, it began to appear normally.  What ever he did, he also worked for Firefox.
    I found a page posted elsewhere mentioned IE8 can you will prompt to download the
    Chinese police if it is not installed.  This moved not, makes me wonder if it was
    there all along.

    Of course, all the other windows dialog boxes and other parts of the interface.
    are English, as it should.  As far as I know, looks like it works the way
    I wanted to.

  • Have a rocket w / 8 gb 8 GB; What is the best way to remove the mp3s in double...

    I looked through some 50 pages and did not find the answer.

    I have a 8 GB Fuze w / additional removable 8 GB.  By mistake I put a few same songs on both discs.  What is the best way to remove these and if I do not remove them, she also ruin added playlists?

    Thank you

    Connect it to your computer, set up 2 separate workstation boxes, one to an intern to exteranal and scroll down... delete the dupes of one of the disks and problem solved

    Edit: I forgot you questions about playlists of pesky things I barely use. Those that you might have to re-do.

  • What is the best way/procedure to check the s10-3/Lenovo updates?

    What is the best way to get updates and drivers Lenovo... ect for my new s10-3.  Thank you, Bill

    Yes, that's correct. In addition, you will notice that most of the drivers have been downloaded 12/31/09. Something more recent that this means that it is a driver newly updated and you can download it.

  • ESXi 4.1 update... What is the best way

    What is the best way to update ESX and keep only it updated... y at - it an automated way to do it, or you have to apply them manually.

    If you have vCenter, you can use VMware Update Manager.

    Otherwise, see below

    http://KB.VMware.com/kb/1019239

  • Just bought a new Apple computer. What is the best way to transfer the CS6 and Lightroom

    Just bought a new Apple computer. What is the best way to transer CS6 and Lightroom? Both applications have been updated. Should I reinstall it on the Adobe site?

    first of all, if you're going to retire this old computer or, at least, no longer use your adobe on this old computer programs, open and click Help > deactivate.

    then install your files to your new computer and activate.  If you already have an installation cd, you don't need to download.  If you don't have the installation files, download the trial and activate it with your order number.

  • What is the best way to remove variables?

    I need to remove several variables to repository and the initialization block that contains.

    They are not referenced in the company or the presentation layers.

    What is the proper way to remove them?

    Thanks in advance for any response.

    There is no set procedure for Oracle/Siebel.

    The RPD does not hurt if you follow or don't follow any procedure.

  • What is the best way to show 1000 objects moving in a field?

    Hello. I'm trying to JavaFX 2.0 and higher. I want to create 1000 objects (because now they can be rectangles) and move them randomly (for now). What is the best way to do this? Do I have to create an initial keyframe for each object? I was watching the demo of BrickBreaker. Is all that I need? I'm looking for a simple example. For example: ColorfulCirclesSample. Basically, what I want to do is create 1000 rectangles with random attributes including a vector (direction and speed) and show them using JavaFX 2.x.

    Thanks in advance.

    ServandoC

    Not that this is the best way, but it's an example, you can try:

    import java.util.Random;
    import javafx.animation.*;
    import javafx.application.Application;
    import javafx.event.*;
    import javafx.scene.*;
    import javafx.scene.image.*;
    import javafx.scene.input.KeyEvent;
    import javafx.scene.paint.Color;
    import javafx.scene.transform.Rotate;
    import javafx.stage.Screen;
    import javafx.stage.Stage;
    import javafx.util.Duration;
    
    // animates a 1000 objects (klingons) moving around the scene at random directions and velocity.
    public class ObjectsInMotion extends Application {
      private static Random random = new Random(42);
      private static final int    N_OBJECTS   = 1000;
      private static final int    OBJECT_SIZE = 20;
      private static final Image  KLINGON = new Image("http://icons.mysitemyway.com/wp-content/gallery/green-jelly-icons-transport-travel/038998-green-jelly-icon-transport-travel-star-trek-sc43.png", OBJECT_SIZE, OBJECT_SIZE, true, true);
      public static void main(String[] args) { launch(args); }
      @Override public void start(final Stage stage) throws Exception {
        // initialize the stage to fill the screen with klingons.
        stage.setTitle("Starboard bow");
        stage.setFullScreen(true);
        final double screenWidth    = Screen.getPrimary().getBounds().getWidth();
        final double screenHeight   = Screen.getPrimary().getBounds().getHeight();
        final Group objects = new Group(constructObjects(N_OBJECTS, OBJECT_SIZE, (int) screenWidth, (int) screenHeight));
        stage.setScene(new Scene(objects, screenWidth, screenHeight, Color.MIDNIGHTBLUE.darker().darker().darker()));
        stage.show();
    
        // press any key to exit the program.
        stage.getScene().setOnKeyTyped(new EventHandler() {
          @Override public void handle(KeyEvent event) {
            stage.close();
          }
        });
    
        // move the klingons around according to their motion vectors.
        final Timeline timeline = new Timeline(
          new KeyFrame(
            new Duration(1000/30), // update the klingon's motion 30 times a second.
            new EventHandler() {
              @Override public void handle(ActionEvent event) {
                for (Node n: objects.getChildren()) {
                  // apply the motion vector for this object to determine the object's new location.
                  MotionVector vector = (MotionVector) n.getUserData();
                  double tx = n.getTranslateX() + vector.velocity * Math.cos(Math.toRadians(vector.angle));
                  double ty = n.getTranslateY() + vector.velocity * Math.sin(Math.toRadians(vector.angle));
    
                  // wrap the objects around when they fall off the starfield.
                  if (tx + n.getLayoutX() > screenWidth)  tx -= screenWidth;
                  if (tx + n.getLayoutX() < 0)            tx += screenWidth;
                  if (ty + n.getLayoutY() > screenHeight) ty -= screenHeight;
                  if (ty + n.getLayoutY() < 0)            ty += screenHeight;
    
                  // update the object co-ordinates.
                  n.setTranslateX(tx);
                  n.setTranslateY(ty);
                }
              }
            }
          )
        );
        timeline.setRate(5);
        timeline.getCurrentRate();
        timeline.setCycleCount(Animation.INDEFINITE);
        timeline.play();
      }
    
      // construct an array of n objects of rectangular size spaced randomly within a field of width and height.
      private Node[] constructObjects(final int n, final int size, final int width, final int height) {
        Node[] nodes = new Node[n];
        for (int i = 0; i < n; i++) {
          ImageView node = new ImageView(KLINGON);
          node.setLayoutX(random.nextInt(width  - size / 2));
          node.setLayoutY(random.nextInt(height - size / 2));
          MotionVector vector = new MotionVector();
          node.setUserData(vector);
          // rotate the klingon to align with the motion vector accounting for the klingon image initially pointing south-west.
          node.getTransforms().add(new Rotate(vector.angle + 225, node.getFitWidth() / 2, node.getFitHeight() / 2));
          nodes[i] = node;
        }
    
        return nodes;
      }
    
      // polar co-ordinates of a motion vector.
      class MotionVector {
        final double velocity = random.nextDouble();
        final double angle    = random.nextDouble() * 360;
      }
    }
    
  • What is the best way to buy an iPhone Unlocked 7?

    Hi all

    I am currently using T-Mobile and want to get the new iPhone 7. Since there is no option for a sim-free iPhone, what is the best way to buy the new iPhone? Should I get the T-Mobile one full fare? I know that he will be released version but it will come with a T-Mobile sim so what will do with the sim card? Put it away or give it to T-Mobile? Or should I wait for the version without card sim to appear, which I don't think that will come out until November, and I don't want to wait that long.

    Thank you in advance.

    If you do not want to wait to pay full price for the model from T-Mobile.  You can do whatever you want with the SIM card.

  • I'll do a clean install on a blank hard drive upgrade but want to keep my Firefox settings - what is the best way to do this?

    I'll do an upgrade from Windows XP to Windows 7. I will be installing Windows 7 on a new empty hard drive. I want to keep my bookmarks Firefox and Ad Ons. What is the best way to do it. Thank you for your help.

    Hello

    The best thing for you to do is to make a backup of your Firefox profile. It is a folder that stores bookmarks and Add-ons that you can then add to the reinstalled Firefox on your new operating system.

    Learn you more about the Firefox profile folder, how to backup and restore, here.

    I hope this helps, but if not, please come back here and we can look at in another option for you.

Maybe you are looking for

  • HP Pavilion G72: System Recovery

    I have the recovery partition on my laptop, but whenever I want to do a system restore, it tells me that there is no recovery partition and I want to insert a dvd that I did not so how can I do the recovery partition on my laptop work

  • Pavilion dv6 CNF9132PLW: upgrade a dv6-1160ed msata ssd

    Hello Can I put this DV6-1160ed (Date06, 2009) with a surfboard msata? And what can the size of GB? Thank you Jan

  • How to play songs in alphabetical order?

    Probably a stupid question, but I look for the answer... I have a 2 GB Clip + (8GB MicroSD added on) and I have about 900 songs on the card. I use mp3tag to mark up artist, title and Album (with year, track, Genre and comment empty). I put the album

  • Virtual PC - create new virtual machine snap into button appears not

    I installed virtual PC and having the image in XP mode works on Win 7 64 bit on a Dell Optiplex 990 i5 processor.  However when I choose the Manager of Windows Virtual PC and the Windows Explorer window opens, I see not the option create a virtual ma

  • How to change the password of CTX in R12.1.3

    HelloI need to change the password for CTX. Can you please give me the script to do this? What do I have to use FNDCPASS?Thank you