Using an array with a library function

I have a library function that I would like to use on the data in an array. My problem is that the function(which I am using as a subVI) will not accept an array as the input data. So I need to pass each element of the array through the function, and rebuild the array so it is in the same configuration that it started at. I am hoping that there is a easy way to do this in labveiw without having to use a formula node. Any help would be appreciated.
Amy

I tried to do what you suggested, but for some reason I still can not wire the indexed array to the subVI. The error I'm getting say that I've wired two terminals not of the same type. The type of the sorce is 2D array of long. The type of the sink is unsigned long. I find that error odd seeing that the array has been indexed. I've attatched my VI. What the for loop is trying to do is pass each element of the array through the subVI, then return an array.
Attachments:
VolttoPress.vi ‏41 KB

Similar Messages

  • Passing arrays with Call Library Function does not work after application builder

    Calling a DLL with Call Library Function which requires an array of data works correctly in Labview, but after building an exe with application builder, the call no longer works.  Dereferecing the pointer in the DLL retuns all 0s and not the actual values.
    Solved!
    Go to Solution.
    Attachments:
    TEST.zip ‏28 KB

    I did not run your code because it is a little unclear to me what it does.
    Two things:
    First, is the DLL you are calling the DLL-ified version of PopUpNames.vi? Then the problem is likely that the panel is not being built into the DLL.
    When LabView builds an application / dll, it strips the front panel and block diagram from all VIs that it doesn't think need to show a panel at run time. This reduces file size and increases code security. The App Builder's panel inclusion logic can be overridden by Build Specifications -> Source File Settings -> Remove front panel. A better method is to put a property node on a control in a window you want to show marking it "visible"; this is sufficient to tell the App Builder it should keep the panel.
    Currently Source File Settings shows "no dependencies" (clearly incorrect---another evil side effect of Express VIs I guess) but if you change the settings as shown below to keep ALL panels, one might hope the App Builder can figure it to keep the panel when it deconstructs the Express VI. (Alternatively convert the Express VI into a regular one.)
    A second comment: I am a bit flummoxed at the larger goal here. You are calling LabView DLL from LabView, which doesn't make a lot of sense, so I assume your larger goal is to call LabView from C or vice-versa. In that case be aware that your DLL is x86 (32-bit) but you are passing 64-bit ints as your pointers. In this case it is 32-bit LabView with 32-bit pointers in embedeed in 64-bit containers calling 32-bit LabView with 32-bit pointers in embedeed in 64-bit containers, so it all works, but if your going to call this from C or whatnot you're going to have to follow that same design.
    When calling C code the LabView Call Library Function does have a "unsigned pointer-sized integer" data type that always appears to be 64 bits in the dev env but which actually passes a 64 or 32-bit int to the DLL depending on the environment. The "pointer sized int" has to be 64 bits in the "LabView" part of the code because LabView's strong typing requires the data type to be determined at compile time. Casting all pointers to the largest data type in LabView makes it possible to write platform-independent code, but down at the Call Library level you still have to put the right number of bytes on the stack.

  • How to use structure pointer with « Call Library Function node » in LabVIEW

    I use GetTimeZoneInformation from kernel32.dll. It definition is :
    DWORD GetTimeZoneInformation( LPTIME_ZONE_INFORMATION lpTimeZoneInformation );
    Where
    lpTimeZoneInformation
    [out] Pointer to a TIME_ZONE_INFORMATION structure to receive the current time-zone parameters.
    http://msdn.microsoft.com/library/default.asp?url=​/library/en-us/sysinfo/base/gettimezoneinformation​...
    I don't know how to set this parameter with my cluster based on the TIME_ZONE_INFORMATION structure.
    Your help will be appreciate
    Thanks
    INKSPEC

    INKSPEC wrote:
    I use GetTimeZoneInformation from kernel32.dll. It definition is :
    DWORD GetTimeZoneInformation( LPTIME_ZONE_INFORMATION lpTimeZoneInformation );
    Where
    lpTimeZoneInformation
    [out] Pointer to a TIME_ZONE_INFORMATION structure to receive the current time-zone parameters.
    http://msdn.microsoft.com/library/default.asp?url=​/library/en-us/sysinfo/base/gettimezoneinformation​...
    I don't know how to set this parameter with my cluster based on the TIME_ZONE_INFORMATION structure.
    Your help will be appreciate
    Thanks
    INKSPEC
    If creating a wrapper DLL which does the conversion for you is not an option (I think it won't since that would require C programming and if you knew C programming you wouldn't ask this here) then you will have to create a byte array of appropriate length and just configure the Call Library Node to pass this array as an Array of unsigned bytes and as C pointer.
    On return you will have to copy out the interesting data at the right position.
    First the length of this structure would be:
    typedef struct _TIME_ZONE_INFORMATION {
    LONG Bias; 4
    WCHAR StandardName[32]; 32 * 2
    SYSTEMTIME StandardDate; 8 * 2
    LONG StandardBias; 4
    WCHAR DaylightName[32]; 32 * 2
    SYSTEMTIME DaylightDate; 8 * 2
    LONG DaylightBias; 4
    } TIME_ZONE_INFORMATION
    Total 172 bytes
    Now the fun part will be to actually get out the information. There are a number of difficulties.
    First the strings are 16 bit Unicode so if you are interested in them you will have to call a different Windows API function WideCharToMultiByte function to convert the 16bit Unicode string into an ASCII string. For this part there has been a post here:
    http://forums.ni.com/ni/board/message?board.id=170​&message.id=123821&requireLogin=False
    For the LONG values you would pick 4 bytes at the appropriate offset from the array through the Array Subset function and then typecast it into an int32 and pass that through the Swap Bytes and Swap Words functions to reverse the LabVIEW Big Endian byte swapping in the Typecast function.
    The SYSTEMTIME is a structure with eight 2 byte integers so it would be best to use Array Subset again to extract 16 bytes at the correct offset, typecast this into a cluster with eight int16 numerics and pass it through Swap Bytes too.
    You see accessing such API functions in LabVIEW directly can get easily quite a mess and that is the reason why creating a wrapper DLL to convert properly between LabVIEW datatypes and C datatypes gets soon the easier solution if you need to interface with more than one or two functions taking such complicated data structures.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to use union statement with declare & set function?

    Hi Experts,
            i  have small query about how to use union statement with declare & set function?
    Example as below :
    DECLARE @name AS date
    Declare @name2  AS date
    /* SELECT FROM [2013].[dbo].[OINV] T0 */
    /* WHERE */
    SET @name = /* T0.DocDate */ '[%1]'
    SET @name2 = /* T0.DocDate */ '[%2]'
    select  '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2013.dbo.orct t1
    inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2013.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]
    Union
    /* SELECT FROM [2014].[dbo].[OINV] T0 */
    /* WHERE */
    SET @name = /* T0.DocDate */ '[%1]'
    SET @name2 = /* T0.DocDate */ '[%2]'
    select  '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2014.dbo.orct t1
    inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2014.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between [%1] and [%2]

    You have to create stored procedure in SQL only .
    Like u must have create for Crystal .
    You can execute procedure in query manager but you have to enter parameter manually..
    example
    Exec @Test '20140101' '20140501'
    Every time user has to enter it manually in yyyymmdd format in case of date parameters.
    Example
    Create Proc [@Test]
    as begin
    DECLARE @name AS date
    Declare @name2  AS date
    /* SELECT FROM [2013].[dbo].[OINV] T0 */
    /* WHERE */
    select  '2013',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2013.dbo.orct t1
    inner join 2013.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2013.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2013.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2013].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between @Name and @Name2
    Union
    /* SELECT FROM [2014].[dbo].[OINV] T0 */
    /* WHERE */
    select  '2014',t5.U_salmannm,t1.CardName,t2.sumapplied as CollectionAmount,t2.DcntSum ,t3.DocTotal as InvoiceTotal,
    datediff(dd,t3.DocDate,t1.Docdate) as Days
    from 2014.dbo.orct t1
    inner join 2014.dbo.RCT2 t2 on t1.DocNum = t2.DocNum
    left join 2014.dbo.oinv t3 on
    t3.docentry = t2.baseAbs
    inner join 2014.dbo.ocrd t4 on t1.Cardcode = t4.CardCode
    inner join [2014].[dbo].[@CQ_RTSM] t5 on t4.U_BeatCode = t5.U_RoutCode
    where t2.DcntSum <> 0.000000 and t3.DocDate between
    between @Name and @Name2
    end

  • How to use opus codec with pjsip library ?

    how to use opus codec with pjsip library ?

    Hi,
    The pageDef in app B must have an entry for the method in order to access it. Just adding the adfjar isn't enough.
    You need to go the bindings of the page in app B and add the method you want to access. Once the method is added you can access using the following code:
    BindingContainer bindings = getBindings();
    OperationBinding operationBinding = bindings.getOperationBinding("getWeatherbyCityName");
    Map map =operationBinding.getParamsMap();
    map.put("theCityName", "Tokyo");
    operationBinding.execute();
    This should work.
    Thanks,
    Siddharth.

  • Using an external DLL with "Call Library Function"

    Hi!
    I am trying to use an external DLL which is used from Visualbasic & Delphi:
    http://www.keb.de/common/tools/KEBCOMDriver.zip
    the protKEB.dll accesses the serial port to control an KEB frequency
    inverter.
    Unfortunatly there is no prototype header file for the DLL (no help on that
    from KEB).
    I only have a VisualBasic example program which works with the DLL.
    (Unfortunatly I am no Visual basic expert)
    To initialize the com port I have to use the function: setprotproperties &
    getprotproperties
    they are declared as:
    'Setting the protocol properties
    'ctrl is a pointer to a data structure of type tProtProperty
    Declare Sub setprotproperties Lib "protkeb.DLL" (ctrl As Any)
    'Reading the protocol properties
    'ctrl is a pointer to a data structure of type tProtProperty
    'the desired protocol is entered in ctrl.prottype before calling
    Declare Sub getprotproperties Lib "protkeb.DLL" (ctrl As Any)
    and tProtProperty is:
    Public Type tProtProperty
    ProtType As Long 'Type of Protocol (tProt)
    TimeOut As Long 'ALL protocols
    Baudrate As Long 'ANSI, HSP5
    Comport As Long 'ANSI, HSP5
    Flag As Long 'ANSI, HSP5: 01 = Sendslow
    / IP: 01 = UDP
    Port As Long 'IPort number
    Txtlen As Byte 'IP : length of following
    text or 0
    txt As String * 100 'IP : IP-Address or name
    (maximum length)
    End Type
    I already tried to use a cluster with tProtProperty entries as an Input for
    the function
    setprotproperty in a call library function with:
    Parameter Type : Adapt to type
    Data Format: Pointer to Handle
    but I always get an "exception within external code....."
    What am I doing wrong?
    How does a cluster & a "call library function node" look like that works?
    Any help is really appreciated!
    thanks
    tom
    ,-Thomas Kerberger Physikalisch-Technische Bundesanstalt-.
    | Abbestr.2-12 D-10587 Berlin fon: +49-30-3481338 |
    | mailto:[email protected] fax: +49-30-3481386 |
    `--------Labor 7.33 Messung thermischer Energie---------'

    Thomas,
    LabVIEW cannot call a DLL that has structures directly, you will need to create either a wrapper DLL or CIN that will take in all of the data individually construct the structure, and send it to the DLL function.
    For more information on what a cluster looks like in native code, I would suggest creating a simple cluster, creating a Call Library Function Node on the block diagram with a cluster input. Then right-click on the Call Library Function Node and choose "Create .c file". This will generate the data structure for the cluster and give you a better feel for it. I would then suggest going to the Using External Code in LabVIEW manual that can be found in the LabVIEW Bookshelf (Start»Programs»National Instruments»LabVIEW 6»LabVIEW Manuals or »LabV
    IEW 6.1»Search the LaBVIEW Bookshelf).
    There is also the following: Developer Zone: Passing a Variety of Data Types from DLL to LabVIEW.
    Randy Hoskin
    Applications Engineer
    National Instruments
    http://www.ni.com/ask

  • Passing array to call library function running on VxWorks (cRIO)

    Hello,
    I am using a cRIO 9012 running VxWorks.
    I have a Call library function VI in my application and I want to pass arrays of doubles to this function.
    The problem is that I can not access the values in the array.
    Here is the source code of my function:
    #include "D:\\Programme\\National Instruments\\LabVIEW 8.5\\cintools\\extcode.h"
    double avg_num(double *in1, double *out1)
        double ret;
        ret = in1[0] + out1[0];
        return ret;
    The value of in1[0] and out1[0] is always.
    When passing no arrays but single values, all is fine. But since my application is more complex than this example, I need to pass arrays.
    The block diagram and parameter specification is as shown in the attached screenshots.
    I am compiling the source code with the Gcc 6.3 which is available here:
    http://zone.ni.com/devzone/cda/tut/p/id/5694
    What am I doing wrong?
    Or is passing arrays not supported on cRIO?
    Maybe the makefile needs to be modified?
    Thank you.
    Best regards,
    Christian
    Attachments:
    vi.JPG ‏88 KB
    parameter.JPG ‏41 KB

    I guess I have solved the problem.
    The key was to set the parameter "Minimum size" for all function parameters to <None>.
    Having this, I can read the passed arrays. I do not know why this works but at the moment, it is ok for me.
    Thank you all.

  • How do you use the windows User32.dll Library functions to read variables from other applications that are running

    I am trying to read a text box from a programme running at the same time as my Labview application using calls to the Windows
    User32.dll. I believe I need to find the window handle for the 'form' containing this text string and use this together with
    various other defined input variables to access the sting.
    I have no experience of using this 'Call Library Function Node', but have an understanding of the 'C' programming language. Does anyone have
    example Labview code showing how this might be done.
    Thanks

    If you're trying to access information that's being displayed in the window of another application and that application has no ActiveX interface, then yes, Windows calls can be used. There's a very good example on calling DLLs that ship with LabVIEW. Open the Example Finder (Help->Find Examples) and switch to the Search tab. Enter "Call" in the search box and open the VI "Call DLL". Run the VI, select any of the examples, and click the "Open Example VI..." button. That shows you how to call a DLL.
    Now, given that you have no experience in calling DLLs, have only an "understanding" of C (which to me means you have never written something like a DLL), and don't seem to know that much about what Windows functions you may need, you're going to find this route pretty difficult, especially since you have to deal with Windows API calls, which are not always that easy to do from LabVIEW.
    Let me propose an alternate solution. Go over to http://www.autoitscript.com/autoit3/ and download AutoIt. This is an automation tool that allows you to automate just about anything you want. It has an ActiveX interface that you can call from LabVIEW. I've attached an example VI that shows you how to use it to get the value of a text box from one of the tabs in the computer "System Properties" control panel applet.
    Attachments:
    AutoIt Example (v7).vi ‏25 KB

  • Problem with Call Library Function. Want to pass a string and return a string, but my compiler does not recognize "CStr" and Labview does not recognize my "char *function()" callout

    Hi, I'm trying to use a .DLL I wrote in Visual C++ .NET. The Call Library Function generates a function prototype of "CStr Parser(CStr arg_raw)"
    but my compiler won't accept this. So I change it to how C normally deals with strings "char *Parser(char *arg_raw). Now the Call Librafy Function does not find "Parser" in my .DLL though it is definitely there!
    Help!
    -Fong

    Hello
    You will need to include extcode.h in your C file. You can find this under ..\LabVIEW\cintools folder.
    The include has all the defines you will need.
    Bilal Durrani
    NI
    Bilal Durrani
    NI

  • Using JavaCompiler together with a Library

    Currently I am developing a tool in which Java Source Files are created based on a XSD file with help of a tool named Castor.
    After the generation of the files the files need to be compiled in order to be used by the program. This used to be done with a Library named XMLBean, however I do not wish to use this library anymore.
    As a alternative I ended up using the Java compiler that comes with the JDK in the tools.jar file. This resulted in a problem, which made me search for a other solution. This way I ended up working with the javax.tools.JavaCompiler. However compilation still failed due to the same problem.
    So what is this problem?
    Initially I tested my code generation logic and compile logic in a normal application. The Java code got generated fine using castor, the compilation using both methods I described also went fine.
    The problem occurs when I attempt to use the same logic in a web application I am developing to run on Tomcat. The Code generation goes fine (since the castor library is included in the project) however the compilation goes wrong and results in the following error:
    "package org.exolab.castor.xml does not exist"
    In other words, the compiler does not understand one of the imports of the source file (refering to a namespace in Castor, a library that was used to generate the file, and is included in the web project).
    Does anyone know why compilation fails in a web application but goes well in a normal application? Does anyone know how this problem can be solved, or does anyone know better component for compilation?
    Thanks a lot.
    This is the code I currently use for compilation:
    public void compileJavaSource(String[] sourceFilePaths)
              System.out.println("Begin Compiling of Source Files");
              JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); // Line 1.
              DiagnosticCollector<JavaFileObject> diagnosticsCollector = new DiagnosticCollector<JavaFileObject>();
              StandardJavaFileManager fileManager  = compiler.getStandardFileManager(diagnosticsCollector, null, null); // Line 3.
              Iterable<? extends JavaFileObject> fileObjects = fileManager.getJavaFileObjectsFromStrings(Arrays.asList(sourceFilePaths)); // Line 5
              CompilationTask task = compiler.getTask(null, fileManager, diagnosticsCollector, null, null, fileObjects); // Line 6
              Boolean result = task.call(); // Line 7
              List<Diagnostic<? extends JavaFileObject>> diagnostics = diagnosticsCollector.getDiagnostics();
              for(int i=0; i < diagnostics.size(); i++){
                   Diagnostic<? extends JavaFileObject> d = diagnostics.get(i);
                   System.out.println(d.getMessage(null));
              if(result == true) {
                   System.out.println("Compilation has succeeded");
              else {
                   System.out.println("Compilation fails.");
              System.out.println("Done Compiling of Source Files");
         } Initially I used this:
    com.sun.tools.javac.Main.compile(sourceFilePaths);

    Cross posted. (Sorry about that)
    To avoid people spending time looking for an answer, here is the solution I found myself:
    First off all, for ANT to work, 2 libraries have to be imported in the web project.
    The libraries are: ant.jar and ant-launcher.jar
    Next to that, the library's Xerces (xercesImpl.jar) and xml-apis.jar (also included in ANT). There Library's are also needed to get Castor to work.
    To compile the code of my generated Java Classes I use the following ANT Build file code:
    <project default="build" basedir=".">
         <path id="classpath">
            <fileset dir="WEB-INF/lib" includes="**/*.jar"/>
        </path>
         <target name="build">
            <javac srcdir="src" destdir="WEB-INF/classes" debug="true" includes="**/*.java" classpathref="classpath"/>
         </target>
    </project>The file basically reads every .java file from my "src" folder. Which is the folder I choose to put my generated class files, and compiles them to the WEB-INF/classes folder. This is the folder were Tomcat stores all its classes.
    What went wrong with the compilation I attempted in the opening post, is that javac could not find the Castor Library, even after I added it in my classpath environment variable. Fortunately, with ANT I can define a classpath for the application, which is the WEB-INF/lib folder. This is the folder where Tomcat stores its Library's. Hence, javac can find the Castor Library from then on.
    Finally I call the ant task using the following Java Code:
    public void compileJavaSource(String buildFilePath)
              System.out.println("Start Compilation");
              File buildFile = new File(buildFilePath);
              Project p = new Project();
              p.setUserProperty("ant.file", buildFilePath);
              p.init();
              ProjectHelper helper = ProjectHelper.getProjectHelper();
              p.addReference("ant.projectHelper", helper);
              helper.parse(p, buildFile);
              p.executeTarget(p.getDefaultTarget());
              System.out.println("Compilation Finished");
         }This took care of the problem pretty nicely.

  • Using header files with call library node

    I am writing an application for Palm PDA, and I use call library node to insert some C code written in Codewarrior 9 for PalmOS.
    For some reason, when I build the program for the Palm the builder does not recognise the functions declared in my header files.
    Please help me with this problem and tell me how do I create a header file in Codewarrior so the builder can include it in the Palm application!!!

    Hello
    Can anyone help me out?  I am trying to use a chart with a Sliding Region of intrest function. 
    I would like to be able to zoom in on the RIO and have the ability to zoom back out.
    I would also like to be able to set the initial mid point setting of the RIO slider.  The original file was using the delta T (psec) control to do this.
    I have only been experiementing with this number to see what value works.  If someone could explain what is going on with that control it would help.
    I noticed that when I move the RIO slider to the left all the way the value goes negative, I am not sure if the program stops reading the value
    at zero or not.....
    When you run  the select RIO Rev 4 vi set the DATA COL to PLOT to 1 to see the correct data
    Thanks in advacne
    Tim C.
    1:30 Seconds ARRRGHHH!!!! I want my popcorn NOW! Isn't there anything faster than a microwave!
    Attachments:
    Sliding ROI Rev 4.zip ‏111 KB

  • Call multiple functions from same dll with call library function

    hi,
    i am working on a project in wich we need to make a UI to read out a sensor network.
    the UI should be usable in any project, but every node needs a different piece of code depending on the type of sensor with wich it is equipt.
    so i need to be able to call different pieces of code when i need them, and still be able to use the UI in future projects with possibly new types of node we now don't have.
    so someone told me to use DLL's, cause then i would be able to call the code i need the moment i need it.
    but i have never worked with DLL's (just learned about this option 3 day's ago) so i have a question.
    i know i can dynamicly change the DLL i call with the call library function, but can i dynamicly change the function i call from that DLL ?
    or do i have to put a new call library function for each function i want to call, even if its from the same DLL ?
    kind regards,
    stijn

    nazarim wrote:
    ok so there is no (easy and ubderstandable) way for me to dynamicly change wich function i want to call from a certain DLL.
    but now i started wondering, the path on the call library function is not ment to dynamicly change a DLL
    but it does work so, if i am carefull, can i use it for that purpose or will labview give me a series of problems once i start using it in larger programs ?
    Thepath on the Call Library Node can be used to load a different DLL. Obviously since you can't change the function name your other DLL would have to export exactly the same function name and of course with the same parameters. This is seldom the case so it is not the main use of the path input to the Call Library Node. It's main use is as indicated to load DLLs at runtime rather than at load time of a VI. So that an application can run even when the DLL is missing, until the moment the functionality from that DLL is needed.
    If you can make sure that all your DLLs export the same function name with the same parameter you can use the Call Library Node to call into different DLLs through the path input. If however you would need to call different function names you would have to resolve to some DLL which does do the dispatching and invocation using LoadLibrary() and GetProcAddress(). But unless you need to go with DLLs for some reason using the Call By Reference Node can give you an even more flexible approach. 
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Link with network library functions

    Hi C gurus,
    we have a problem compiling software from outside with the latest Studio 12.3 compiler. We have the following command
    CC -m64 -xlang=f90,c99 -o mars mars.o -L/usr/lib libmars.a /soft/ECMWF/emos-64_i86pc/libemosR64.a -L/opt/solarisstudio12.3/lib -lsunmath -L/soft/EC MWF/grib_api-64_i386/lib -lgrib_api -L/soft/jasper-64_i86pc/lib -ljasper -lm
    and get linker errors like
    Undefined first referenced
    symbol in file
    bind libmars.a(tcp.o)
    sys_nerr libmars.a(environ.o)
    getsockname libmars.a(server.o)
    accept libmars.a(netbase.o)
    xdr_string libmars.a(marsxdr.o)
    xdr_pointer libmars.a(marsxdr.o)
    listen libmars.a(server.o)
    gethostbyaddr libmars.a(tcp.o)
    gethostbyname libmars.a(tcp.o)
    socket libmars.a(tcp.o)
    xdr_bytes libmars.a(marsxdr.o)
    getdomainname libmars.a(environ.o)
    setsockopt libmars.a(tcp.o)
    connect libmars.a(tcp.o)
    xdrrec_create libmars.a(netbase.o)
    xdrmem_create libmars.a(account.o)
    xdrrec_skiprecord libmars.a(queue.o)
    xdr_free libmars.a(queue.o)
    xdr_long libmars.a(marsxdr.o)
    inet_addr libmars.a(tcp.o)
    inet_ntoa libmars.a(tcp.o)
    sys_errlist libmars.a(environ.o)
    xdrrec_endofrecord libmars.a(queue.o)
    xdr_int libmars.a(marsxdr.o)
    shutdown libmars.a(webbase.o)
    Some of this function are Network library function. See http://docs.oracle.com/cd/E19683-01/817-0696/6mgfrf0gr/index.html
    Do we miss some options or flags the CC command line?
    Any help or hints are warmly welcome
    Anton

    You say you are having trouble with Studio 12.3. Did this code work before with some earlier Studio version? I suspect not, because you need to link system libraries that are not on the CC command line that you show.
    First, some general comments.
    1. The -xlang=f90 option should be used if and only if you are linking Fortran 90 binaries to your program. Ditto for -xlang=c99 and C 99.
    2. Never use -L options that point into /usr/lib or into the compiler installation area. The CC driver knows where to find default system libraries and in what order to search for them. Specifying these directories with -L can cause the wrong libraries to be linked. If you added those options because they seemed to solve a linking problem, something else is wrong, and should be fixed.
    Now some specifics about missing libraries.
    Check the man page for a missing function, and see if the man page lists a library that needs to be linked. Unfortunately, not all man pages are so helpful. Let's track down one set of functions as an example of how to find the missing library.
    A set of missing functions starts with "xdr". Let's try "man xdr_string". Although the page does not tell you what library to link, the man page is in section 3NSL, and some xdr functions in the "see also" are in the same section. Is there a library with nsl in its name?
    % cd /usr/lib
    % ls -R | grep nsl
    libnsl.so
    % nm libnsl.so | grep xdr_
    [ long list of xdr functions]So we know we need to add -lnsl to the CC command line. Repeat this process until done.
    The author of an application library usually knows what system libraries to link, and a helpful programmer would include this information in README or man page for the application libraries that you are using. Did you check for documentation first?

  • Win SDK function conflict with CVI library function

    I do not have  SDK_CONFLICT_PRIORITY defined.  Is this new to CVI 2009?
    The following code gives me an error  "11, 58   Too many arguments to `CVI_WriteFile'."
    #include <windows.h> 
    #include <formatio.h>  
    void function (void) {
        HANDLE hHandle = INVALID_HANDLE_VALUE;
        char buffer [1000] = {'\0'};
        DWORD dwWriteCount;
      if (!WriteFile (hHandle, buffer, 5, &dwWriteCount, NULL)) {
    I have included  <windows.h>   before   <formatio.h>  but CVI still wants to use the formatio version of WriteFile - it appears to have been renamed   CVI_WriteFile  ?!?!?
    If I eliminate the #include <formatio.h>  it compiles OK.
    Message Edited by menchar on 03-06-2010 04:00 PM

    Well, the complete source for formatio.h I reported before is this one:
    #ifdef _NI_mswin32_
    extern int CVIFUNC      cviprefix(CloseFile)(int handle);
    extern int CVIFUNC      cviprefix(OpenFile)(const char *filename,int rd_wrt, int action, int bin_ascii);
    extern int CVIFUNC      cviprefix(ReadFile)(int handle, char *buf, int count);
    extern int CVIFUNC      cviprefix(WriteFile)(int handle, const char *buf, int count);
    extern int CVIFUNC      cviprefix(SetCommitMode)(int commit);
    #define CloseFile       cviprefix(CloseFile)
    #define OpenFile        cviprefix(OpenFile)
    #define ReadFile        cviprefix(ReadFile)
    #define WriteFile       cviprefix(WriteFile)
    #define SetCommitMode   cviprefix(SetCommitMode)
    #else
    In the header this warning is present:
    /* This header must be included after any Windows SDK header or any header */
    /* that directly or indirectly includes a Windows SDK header.              */
    /* Some of the function names conflict with Windows SDK functions.         */
    As far as I can understand (but I'm not an expert on these very technical and tricky aspects of C) first of all CVI functions are renamed CVI_xxx, after it a call to WriteFile or any other function in that group is defined to be translated to CVI_WriteFile, so when you call WriteFile the preprocessor actually translates it in the CVI version of the function and SDK one is superseded.
    My understandment is that if you undefine WriteFile, you can actually use both functions if you want: native CVI one by calling CVI_WriteFile and SDK one by simply calling WriteFile.
    ...or I can be missing some other hint, which can surely be possible!
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • VI analyzer: Wire under object test fails with Call Library Function Nodes

    Hi,
    If I wire a Call Library Function Node with an ErrorIn and an ErrorOut, the VI Analyzer Test "Wire under Object" fails always with two occurrences per Call Library Function Node.
    A double click to the occurrence highlights the error lines connected with the call... node.
    The test does not fail, if the error lines are not connected.
    Thanks!
    H
    Solved!
    Go to Solution.

    This became a problem when Call Library Nodes got error terminals (and optional path terminals) in LabVIEW 8.20.  I should be able to get a fix in to VI Analyzer Toolkit 2010.
    Thanks for taking the time to report the bug.
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

Maybe you are looking for

  • New Camera Roll backup/restore issue...

    Hello, I have a massive problem and cannot find an answer to this anywhere....so, i'm hoping someone here can help. (I'm not great with computers!) I upgraded from iphone4 to 4S in February. I set-up with icloud, but turned off both the Camera Roll a

  • Data mining is Loading after upgrade from 10.1.0.4 to 10.2.0.4

    SQL> select comp_name, version, status from dba_registry; COMP_NAME VERSION STATUS Oracle Ultra Search 10.1.0.4.0 NO SCRIPT Oracle XML Database 10.2.0.4.0 VALID Oracle Enterprise Manager 10.2.0.4.0 VALID COMP_NAME VERSION STATUS Oracle Text 10.2.0.4.

  • Creating a graphical summary of response based on the views created

    I created an OOTB survey and created 4 different quarterly view to see the summaries. When I select "show a graphical summary of response," the results are not view specific. Instead, the graphs reflect the total responses. Is there a way to show the

  • Playlist impoirt not saved

    I keep getting a message that says "Playlist or Songs not recognized and cannot be saved." I have all the songs on my ipod from the last time that I synced it. However when I add new songs to itunes, it only reads the new uploaded songs and wants to

  • Which case WON'T peel off my GhostArmor screen protector!?

    I know there's a lot of discussion about this already, but I was wondering if anyone has advice on which free case to go with that hopefully will NOT peel off the corners of my Ghost Armor full body protector. I have tried NUMEROUS silicone cases so