Functions of DLL Labview only each returns 0 when it is called in C

Hey guys. I'm having a problem using a dll built in labview in my code C. I did a labview program that read the current analog signals 7 analog pins and them stored in a table. Then I have a variable that corresponds to the index that you want to localize (whenever the function is called I don't read only one current value of the table) and then put this value into a digital indicator that is the result I want.

It has worked well in labview, but after I generate a DLL to it and call the function in my c code it always returns 0 instead of reading of the axis. Even when I put constant values in the table, when I call the function I always get 0. I also did a labview program who just returned a constant number by pressing, and when I built as a DLL and calls the function in my C code it issued yet only 0.

I am very confused how this happens. I have connected the digital indicator to the connector and component when I build the DLL it claims that I'm a function that is:

Double Test1 (double Index)

Where "double index" is the index of the table that I want to read, and the return value is the digital indicator that contains the value at this level.

I call the funcition in my C code as follows:

#include "SharedLib.h" //This is the header for the DLL file. I also include .lib, .dll, .ini, and .alias files
#pragma how (lib, "SharedLib.lib")

Double i = 0;   just for an example, I'm access at index 0 of the table, which I set to a constant value

values = Test1 (i);  It will always return 0, regardless of what the index is

I guess my big question is how is it possible to get the labview function built DLL to run C code but only eery return 0? I can show you all my Labview code, but as I tried several functions to try to get a value not zero to not think availI miss me something else which isn't regardng real labview code. Thank you very much!

Indexing by a double seems to be ok in Labview. I understand the problem however. The labview functions actually worked, I was just incorrect printing. I was really stupid and my printf statement was printf ("%d", value) printf ("% lf, value) which is what you need for the double rooms, and he did print always 0. Thanks for your help though guys.

Tags: NI Software

Similar Questions

  • Get the 1097 error when trying to call a Labview DLL

    I had to write a wrapper DLL to use some functions in the DLL to a third party, and I'm having a few problems. I created an executable to test my code and it works fine, but when I try to execute the same function in the DLL that I created in Labview, I get error 1097. I read through most of the posts on this forum about this issue, but none of the proposed solutions are working for me. I'm sure this isn't a question of transfer settings to COLD LAKE because I changed the function so it only accepts a single entry (a number he obtains from a Subvi, which came from the third-party DLL, this entry is working with a bunch of other functions, so I don't think that is the question).

    I have attached the C code that creates the wrapper, but I don't know how it is useful without familiarity with the functions of the original DLL. I hope that someone can spot something basic I am out of my code, but please let me know if I need to call something else.

    I use a Labview 32 bit version 2012 on a 64-bit Windows 7 computer.

    Thanks in advance for any help!

    You should read the documentation on LoadLibrary() and understand. Essentially if you provide a full path to LoadLibrary() the DLL MUST be present at this place so that LoadLibrary() will succeed. If you pass only the name Windows DLL will ONLY search in these places:

    (1) if the module (the DLL) is already loaded it will return a handle to the loaded module and increment its reference count

    (2) if the referencing module contains a manifest (either incorporated into the image module or in a separate manifest file in the same directory as the executablemodule) specyfying a version number for this DLL will load this DLL with this version of the SxS (side by side) location and failure if it is not present

    (3) if the executable load contains a manifest (either incorporated in the executable file or in a separate manifest file in the same directory as the executable file) number specyfying a version for this DLL, it will load this DLL with this version of the location of SxS (side by side) and fail if it is not present

    (4) it will search for the DLL in the same directory as the directory where the current image of the process is loaded. It is NOT the directory of the DLL loading the DLL, BUT the directory where the EXE file from which the process was created.

    (5) in the system directory

    (6) in the Windows directory

    (7) any directory in the PATH environment variable

    (8) the path of current directory which is a location managed by windows by process and changed the two explicitedly when the application calls the API SetCurrentDirectory() but also implicitedly by things like the file selection dialog whenever it is rejected by other means than the undo operation.

    Essentially putting your dependend DLL in the same directory as the wrapper DLL does NOT work when you use the name of the DLL only UNLESS you place the two DLLs in the same directory as your executable file. If you don't want this restriction and want to be able to move these modules together in different directories, you don't have to create the correct path in your wrapper to LoadLibrary(). Basically, you must have the code to determine the location of your DLL wrapper path and then strip her own name and add the DLL name wrapped in it and then move to the LoadLibrary().

    There are several ways to determine the path of the current module. The simplest if you don't mind having the name hard-coded in your code DLL would be to ask GetModuleFileName (GetModuleHandle ("yourDLLname"), buffer, size).

  • Is the fopen() function works in labview?

    Hi gentlemen...

    I used the fopen() function in labview, it does not work. Is that I can use the fopen() function works in labview?

    Please help me as I'm new to labview.

    Thanks in advance

    Can you give us a description of how you try to do this?

    You realize that LabVIEW is not based on text, no?

    Looking just for another equivalent method? http://zone.NI.com/reference/en-XX/help/371361J-01/lvprop/vi_open_front_panel/

  • Why my function returns nothing when I create as a schema object

    I have the ABC's of the user who owns several paintings, some of which have foreign key constraints.

    I have user XYZ who has access to all the tables belonging to the user ABC.

    When I create a user XYZ feature to use more I get no return when I run:

    Select XYZ.ztm_tables_depended_on ('ABC', 'A_TABLE_OWNED_BY_ABC') of double:

    Please see after the function definition.

    CREATE or REPLACE FUNCTION ZTM_TABLES_DEPENDED_ON (p_Owner VARCHAR2, nom_table_p VARCHAR2) RETURN VARCHAR2 IS

    CURSOR C1 IS

    SELECT CONSTRAINT_NAME, OWNER, R_CONSTRAINT_NAME, R_OWNER

    OF ALL_CONSTRAINTS

    WHERE OWNER = p_Owner

    AND TABLE_NAME = nom_table_p

    AND CONSTRAINT_TYPE = 'R '.

    ORDER BY OWNER, CONSTRAINT_NAME, R_OWNER, R_CONSTRAINT_NAME;

    --

    v_Referenced_Owner VARCHAR2 (31);

    v_Ret_Val VARCHAR2 (4000);

    --

    The FUNCTION CONSTRAINT_TABLE_NAME(p_Owner VARCHAR2, p_Constraint_Name VARCHAR2) RETURN VARCHAR2 IS

    CURSOR C1 IS

    SELECT TABLE_NAME

    OF ALL_CONSTRAINTS

    WHERE OWNER = p_Owner

    AND the argument CONSTRAINT_NAME = p_Constraint_Name;

    --

    v_Ret_Val ALL_CONSTRAINTS. TABLE_NAME % TYPE;

    BEGIN

    OPEN C1;

    FETCH C1 INTO v_Ret_Val;

    CLOSE C1;

    --

    RETURN v_Ret_Val;

    END;

    --

    BEGIN

    FOR R IN C1 LOOP

    IF (R.OWNER <>R.R_OWNER) THEN v_Referenced_Owner: = R.R_OWNER | '.';

    ANOTHER v_Referenced_Owner: = NULL;

    END IF;

    --

    v_Ret_Val: = v_Ret_Val | ', ' || v_Referenced_Owner | CONSTRAINT_TABLE_NAME (R.R_OWNER, R.R_CONSTRAINT_NAME);

    END LOOP;

    --

    RETURN LTRIM (v_Ret_Val, ',');

    END;

    /

    But if I enter the function within an anonymous block as follows, I get results:

    DECLARE
    CURSOR C1 IS
    Select owner, table_name
    From all_tables where owner = 'ABC ';

    --

    The FUNCTION ZTM_TABLES_DEPENDED_ON(p_Owner VARCHAR2, p_Table_Name VARCHAR2) RETURN VARCHAR2 IS
    CURSOR C1 IS
    SELECT CONSTRAINT_NAME, OWNER, R_CONSTRAINT_NAME, R_OWNER
    OF ALL_CONSTRAINTS
    WHERE OWNER = p_Owner
    AND TABLE_NAME = nom_table_p
    AND CONSTRAINT_TYPE = 'R '.
    ORDER BY OWNER, CONSTRAINT_NAME, R_OWNER, R_CONSTRAINT_NAME;
    --
    v_Referenced_Owner VARCHAR2 (31);
    v_Ret_Val VARCHAR2 (4000);
    --
    The FUNCTION CONSTRAINT_TABLE_NAME(p_Owner VARCHAR2, p_Constraint_Name VARCHAR2) RETURN VARCHAR2 IS
    CURSOR C1 IS
    SELECT TABLE_NAME
    OF ALL_CONSTRAINTS
    WHERE OWNER = p_Owner
    AND the argument CONSTRAINT_NAME = p_Constraint_Name;
    --
    v_Ret_Val ALL_CONSTRAINTS. TABLE_NAME % TYPE;
    BEGIN
    OPEN C1;
    FETCH C1 INTO v_Ret_Val;
    CLOSE C1;
    --
    RETURN v_Ret_Val;
    END;
    --
    BEGIN
    FOR R IN C1 LOOP
    IF (R.OWNER <>R.R_OWNER) THEN v_Referenced_Owner: = R.R_OWNER | '.';
    ANOTHER v_Referenced_Owner: = NULL;
    END IF;
    --
    v_Ret_Val: = v_Ret_Val | ', ' || v_Referenced_Owner | CONSTRAINT_TABLE_NAME (R.R_OWNER, R.R_CONSTRAINT_NAME);
    END LOOP;
    --
    RETURN LTRIM (v_Ret_Val, ',');
    END;

    --

    BEGIN
    FOR R IN C1 LOOP
    DBMS_OUTPUT. Put_line (ztm_tables_depended_on (R.Owner, R.Table_Name));
    END LOOP;
    END;
    /

    Any ideas what is happening here?

    Any ideas what is happening here?

    Justin said the likely reason.

    See the section "How to exercise roles in PL/SQL blocks" the doc of database security for details

    http://docs.Oracle.com/CD/E25054_01/network.1111/e16543/authorization.htm#i1007304

    Operation of the roles in PL/SQL blocks

    The use of roles in a PL/SQL block depends on if it is an anonymous block, or a block named (stored procedure, function, or trigger), and if it runs with the rights of the author or the rights of the applicant.

    Roles used in the appointed with rights to define blocks

    All roles are disabled in any PL/SQL block named (stored procedure, function, or trigger) that runs with the rights of the author. Roles are not used to privilege control, and you cannot define roles within the procedure of a DEFINER rights.

    The SESSION_ROLES view shows all roles that are currently enabled. If a named PL/SQL block that runs with Definer Rights queries SESSION_ROLES , then the query will return no rows.

    Roles used in blocks named with the rights of the plaintiff and anonymous PL/SQL

    Named PL/SQL blocks that run with the rights of the applicant and the anonymous PL/SQL blocks are executed at the end of the privileges granted through active roles. Current roles are used for verification within rights Summoner of privilege the PL/SQL block. You can use dynamic SQL statements to define a role in the session.

    See this line beginning by "all roles are disables in any PL/SQL block named"?

  • getBytesLoaded() and getBytesTotal() return anything when you load content from another domain

    I created a movie that load various media using loadMovie(), then in many cases performs actions on the newly loaded MCs once loading is completed. I rely on getBytesLoaded and getBytesTotal to know when to perform these actions.

    This works very well when the content is on the same server as the film, but I also need to load content from another domain and this is where it falls apart. The media actually does very well in the target MCs, but never make the functions that need to be running when the loading is complete. The problem is that getBytesLoaded() and getBytesTotal() both return nothing when the content is loaded from another domain.

    I'm stuck with loadMovie and getBytesLoaded/getBytesTotal as this film must be published for Flash Player 6, but I actually tried to use loadClip() and onLoadInit() and I get the same problem - onLoadInit() never works.

    Another weird thing is that test by displaying a flash preview is not displayed this problem - the content of fines and getBytesLoaded and getBytesTotal loads two values to return as expected. It's only when I publish the film and display in a browser I have this problem.

    Where I'm going wrong?

    Thank you!

    in your external SWF on the other server, type the following in the first picture...

    Code:

    System.security.allowDomain (_parent._url);

    If you load your swf file into a movieclip with instance name mcImage and then do

    Code:

    System.security.allowDomain (mcImage._url);

  • How to use Quicktime Player 7 Pro registration for second computer? View order history goes back only 18 months. When I enter my key QT7 he just told me to buy again.

    How to use Quicktime Player 7 Pro registration for second computer? View order history goes back only 18 months. When I enter my key QT7 he just told me to buy again.

    You need a separate license for each Mac.

  • description interface LabVIEW node will not work when compiling

    Hello

    I have a vi that seeks VISA resources and focuses on their name of the interface to select that you connect to.

    I have a strange problem where, if I run the vi in labview it works fine. When the vi is compiled into an exe file, it does not work.

    I traced the problem to the property node "name of Inst Intf' which gives the description of the interface. In Labview, the node of this property returns the description of the interface, as expected.

    When I compile the vi, this node property returns empty strings.

    The station nearest you, that I could find to this kind of problem is it

    http://forums.NI.com/T5/instrument-control-GPIB-serial/why-visa-property-interface-information-inter...

    However, the exe is running as an administrator, so I don't think it's a problem with permissions.

    Any help would be greatly appreciated.

    I have no idea of what was the cause, but I uninstalled the device drivers for the hardware I used, reinstalled and then restarted the computer and now it works fine.

  • NOR-DAQmx: nicrtsiu.dll not an Image Windows validates when you use DAQmx features

    Hi all...

    I had the problem using nor-daqmx in Labview...

    When not to use Ni-DAQmx, I have not had any problems using it

    So, try to use one of the NI Daqmx works.

    She appeared a message

    "The application or DLL C:\WINDOWS\system32\nicrtsiu.dll is not a valid Windows image

    "Please check this against your installation diskette."

    Here are versions of the programs that I use.

    -Win XP Pro 2002 SP3

    - NI Labview 7.1

    -Driver OR DAQmx 8.5.0f3

    - NO Max 4.2

    I am baffled by this error

    Please advise kindly.

    Thank you

    Clement

    Hello..

    I have the same problem, as your problem.

    If you solved your problem, I want to know your opinion.

    Please, I beg you. Send me your email address.

    My email address is "[email protected]".

    Nice day.

  • How to set a menu of VI function to generate a copy of it self when it is move and dropped on the block diagram

    Is any way to put a VI that I placed on a palette in the menu functions to create a copy of it self when I place it on the block diagram?

    My example is as follows. I create a palette for a messaging configuration. The 'send message', 'message' and so forth will work normally with just called when necessary. But 'Create queues messge' must be specific for each instance, because I'm going to create a different number of queues each time I use it. (See system messages in queue OR for the "Continous Measument and Logging" model).

    So every time I drag and drop that VI (Create message Queues) in the palette, I want that it ask me where I want to save the VI.

    Is this possible?

    See you soon

    Henrik

    There is always the file-> new... that opens a new window.  You can have your models in this window by putting them somewhere (I can't remember where at the moment).

  • labVIEW: resource not found. When you run executable

    Hello

    I had a fully functional vi with LabVIEW 2009 (continued from developer) and must be able to run it on another PC without him.  I downloaded LV Run-Time 2009, but when I try to run the executable I built, I get an error that reads:

    LabVIEW: Reasorce not found.

    An error occurred loading VI ' NI_AALPro.lvlibderivative x (t) .vi '.

    LabVIEW support 3 error code: could not load before panal.

    I can run the executable on another PC with LabVIEW without problem.  I read somewhere on the need to stop the front panal beng removed on void screws with Application Builder, although I don't think I have.  I apologize in case this is a stupid question, and I appreciate any help.

    See you soon

    Luke

    In the Project Explorer, click with the right button on the construction specifications and select new > Installer.

  • How can I get the messages appear when sent even if my phone is locked. I only get messages across when I activate the phone

    How can I get the messages appear when sent even if my phone is locked. I only get messages across when I activate the phone

    Settings > Notifications > Messages > display on the lock screen

  • I want to cancel an app cause they keep in charge each month but when I cancel it still load

    I want to cancel an app cause they keep in charge each month but when I cancel it still load

    Follow the instructions here to make sure you have completely cancelled the subscription. View, change or cancel your subscription - Apple Support

    -AJ

  • I get only a skeleton display when I go online, why? everyone has an easy to follow the answer

    I get only a skeleton display when I go online, why? everyone has an easy to follow the answer

    Hello

    1. is this issue happening with a particular Web site? If Yes, then which is the Web site?
    2. what browser do you use to go online? If you use Internet explore, then what version of Internet Explore do you use?
    3. you receive an error message when you try to go online?
    4. have you made changes on the computer before this problem?
    If you use Internet explore, you can read the following article.
    The video problems when you use Internet Explorer

    Warning: him reset Internet Explorer settings feature might reset security settings or privacy settings that you have added to the list of Trusted Sites. Reset the Internet Explorer settings can also reset parental control settings. We recommend that you note these sites before you use the reset Internet Explorer settings.

     
     
    You can also provide us with the screenshot of the screen, when you sign in. See the following link on how to do i: after a screen shot on this forum?
    http://Windows.Microsoft.com/en-us/Windows-XP/help/Setup/take-a-screen-shot
    Here are the steps to upload a screenshot:
    (a) on the private domain of my post, click download file.
    (b) click on select.
    (c) navigate to where the download file is saved on your computer and click on submit.
     
  • 6525 HP trying to print photos only from photo tray when I print from iPhone

    6525 HP trying to print photos only from photo tray when I feel of the iPhone. A4 paper loaded, but 6525 does not print on it and output the message "Insert photo paper." Can you help me?

    Hello

    The default settings on the devices Apple Airprint is printing photos from the photo tray and all other documents of the main paper tray.

    For more flexibility with regard to the selection of media and the status bar, please download the HP e-Pprint app. You will find the Setup instructions for e-Print here.

  • Return of the request to call him?

    I managed to invoke work goes to the settings screen.  My application becomes small / inactive when the application settings opens.

    When you press the button to return to the settings screen, the settings app closes and my application is still reduced / inactive.

    Is there a way to return my application to the before State / active when the application called (parameters) is over?

    Nope...

Maybe you are looking for

  • Spotify on iWatch

    Can Spotify iWatch sync playlists 2 so I can go without my iPhone and listen to music through my Bluetooth headset?

  • "Support for Shared iPad in iOS 9.3.

    In the description for the GarageBand 2.1.1 iOS update, I see one of the items listed is "Support for Shared iPad in iOS 9.3.» Out of curiosity, what it means exactly? What this has to do with the support of several users to create GarageBand project

  • Satellite A300-1QD - two questions during the installation of windows XP or Vista

    Nice dayHere's my problem: 1. I just bought the Toshiba Satellite A300-1QD and since there is Vista based on it and I have Vista ultimate, I decided to install on the laptop.After I formatted deleated everything and I have the partition that I create

  • Macbook pro to a jet m1212nf laser printer scan

    Hello I'm trying to scan from a LaserJet M1212nf MFP to a MacBook Pro running Mountain Lion. I installed the latest LaserJet driver from the HP website. Can I print using a USB connection. However I can not scan. If I open the HP Director, by clickin

  • Windows xp home edition version 2002 service pack 3, media sharing works do not share for xbox 360

    on my pc with windows xp home edition version 2002 service pack 3, when you try to turn on media sharing on my xbox 360.When I check the media sharing box nothing happens.This is the step that I'm doing. Step 3: Turn on media sharing. Click the arrow