Calling external C-functions in DLLs with struct as parameters

Hi all PL/SQL Gurus !
Is it possible to call external functions in a DLL written in C
wich has pointers to C-structs as parameter. Can you point me to
an example or extended documentation about this. I had a look at
the Oracle doc's but found no examples about structs.
Thank you very much,
Stefan.
P.S.: Konfiguration: Oracle 8.1.7.0.0 Client and Server on W2K-
SP2 machines.

Hi,
I have the same problem with you.Now,have you resolve the problem?
I want to know how to do.if you resolve it ,could you give me a example.
thanks .
best regards!
Liyf

Similar Messages

  • Call External C++ function and pass XML

    Hi,
    I need to call external C++ function from Oracle and pass to it XML file from Oracle table? Can you give short guide how to do it?
    Regards

    Your question sounds like is about using an Oracle database (or other application), and not about C++ programming or the using the C++ compiler. You are more likely to find a helpful answer in an Oracle database (or other application) forum.

  • Call a Borland Delphi DLL with Structs from LabView

    Hello,
    I have a problem to build an equivalent Struct in Labview to the following Struct which I want to retrieve from a DLL.
    type
    TM2DScanline=record
    YWert:double;
    XWert:array[0..raster] of double;
    ZWert:array[0..raster] of double;
    IWert:array[0..raster] of byte;
    end;
    M2DScanArea =array[0..maxScans] of TM2DScanline;
    PointerToScanArea=^M2DScanArea;
    PointerToScanArea is the parameter I want to retrieve.
    If anybody knows a way for doing this, help would be very appreciated
    Thanks
    Peter

    Are raster and maxScans both constant? If I recall correctly, many dialects of Pascal just lay the elements of a fixed-size array out in memory with no size parameter; if this is the case with Delphi, then you may be able to do the following (in my example, I'll assume "raster" is a constant set to 40, and maxScans is a constant set to 5):
    Create a cluster called XWert with 40 Numeric elements (representation: DBL).
    Copy XWert and name the copy ZWert.
    Create a cluster called IWert with 40 Numeric elements (representation: U8).
    Create a cluster called TM2DScanline.
    Create a Numeric inside TM2DScanline called YWert (representation: DBL).
    Drag XWert, then ZWert, then IWert into TMD2Scanline.
    Create a cluster called ScanArea and drag 5 copies of TMD2Scanline into it.
    Create a Call Library node on your block diagram, give it your DLL and function name, and set the return value to whatever your Delphi function returns. You probably want the WINAPI calling convention.
    Add a parameter and make it "Adapt to Type: Pointers to Handles". Close the node and wire the ScanArea cluster to the input.
    Right-click on the Call Library Node and select "Create .c file...." Read through the C file to make sure its structure is similar to your Delphi record: you should see five copies of the TM2DScanline structure, each of which contains a double followed by two fixed 40-element structures of double and a fixed 40-element structure of unsigned char. You should see no reference to the word "Hdl" anywhere in the code.
    This strategy will only work if the arrays in your records are fixed at a constant size, and if Delphi lays out the arrays in memory as described above. Instead of doing all this work, you may want to write a small C or Pascal wrapper around your Delphi function. This wrapper could take simpler parameter types (which are easier to use from LabVIEW) and bundle them into the cluster before calling your Delphi function.

  • How to use Call library function node for a function in dll with VOID data type

    Hi All,
    I would like to ask for your kind help,
    I am facing an issue with the call library node.
    I have a C++ function(stdcall), which has void as data type
    error code XXXX(hwnd, lID, getValue, *void data1, *void data2)
    the data1 and data2 types are always changing depending upoin the value of "getValue".
    Primarily i can use call library node multiple times and adapt each node according to the data types of data1 and data2, and extract the values and use in the code. Here is no issue. Real question is:
    My question:
    How can i just use one time call library node and make a case depending upon the "getvalue", which will control the data type of data1 and data2. Here i really looking for solutions.
    My trials:
    i used varaints as input to the call libray node for data1 and data2, and selected Parameters in call libraby node as " Adapt to type". here labview just crashed.
    i really appreciate your feedbackand suggestions.
    Thanks
    Kutbuddin
    Solved!
    Go to Solution.
    Attachments:
    Clipboard02.jpg ‏103 KB

    A variant is a very specific LabVIEW datatype (really a C++ type object internally) and trying to pass that to a function, which excepts a flat memory pointer there, for sure will crash very quickly.
    As to endianess, yes Unflatten will be able to adjust for endianess, which in this case however is most likely exectly NOT what you want. So make sure that the you select native type for the endianess input on Unflatten from String. LabVIEW internally works with whatever is the native endianess, as will most likely your C++ DLL. The platform independent big endian format does only come into play when you receive data streams over some streaming interface like a network connection. Here it is desirable to use an endian format that is independent from the actual platform that generates and consumes the data stream. LabVIEWs default endianes is big endian here.
    But as long as you pass data directly to native components like DLLs there is no difference in endianess between what LabVIEW uses and what those components use.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Having problem with calling external javascript functions in LV

    Hi,
    I found this VI: http://lavag.org/topic/10304-discuss-calling-external-javascript/, which I believe can be really helpful for my work. The problem is I can't get it to run based on the following problem:
     - Apparently the "ScriptControl" cannot be loaded
    I am using LabView 8.6, and this vi has been produced in a 8.0 version. Do you think this is the problem? If not, what could cause this problem running this VI?
    Thanks,
    Diogo

    Hi,
    To start I am using this examplo from the google code page.
    <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>Google Maps JavaScript API Example</title>
        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=abcdefg&sensor=true_or_false"
                type="text/javascript"></script>
        <script type="text/javascript">
        function initialize() {
          if (GBrowserIsCompatible()) {
            var map = new GMap2(document.getElementById("map_canvas"));
            map.setCenter(new GLatLng(37.4419, -122.1419), 13);
            map.setUIToDefault();
        </script>
      </head>
      <body onload="initialize()" onunload="GUnload()">
        <div id="map_canvas" style="width: 500px; height: 300px"></div>
      </body>
    </html>  
    It loads a basic map, and is saved in a html file created for example in Notepad. Basically as I said the VI is very simple, see next image.
    But like I said, this strategy does not allow labview to interface dinamically with the javasscript code in the html file. Doing it this way, I would have to constantly update the code in the file with new coordinates and loading the map again. This causes the mentioned flickering problem that I also had with static maps.
    Diogo

  • Error while calling external library functions

    Using visual studio I wrote the following code test javascript communication with external C/C++ libraries:
    aabc.cpp :
    extern "C" __declspec(dllexport) char* ESInitialize (TaggedData* argv, long argc);
    extern "C" __declspec(dllexport) long ESGetVersion (void );
    extern "C" __declspec(dllexport) void ESFreeMem (void* p);
    extern "C" __declspec(dllexport) void ESTerminate (void );
    extern "C" __declspec(dllexport) double AddNumbers(void);
    double AddNumbers(double a, double b)
    return a + b;
    long ESGetVersion (void){
    return 5;
    And the code that I wrote in javascript is:
    var obj = new ExternalObject("lib: aabc.dll");
    alert(obj.version);
    var aa = obj.AddNumbers(10, 20);
    alert(aa);
    It seems to me that it loaded successfully due to the output I am getting from the second statement. But I am getting error at the third statement where I called AddNumbers(10,20) function.
    Somebody help me.
    Thanks in advance,
    sailu

    I have the same problem. This is my code:
    extern "C" __declspec(dllexport) char* ESInitialize (TaggedData* argv, long argc);
    extern "C" __declspec(dllexport) long ESGetVersion (void );
    extern "C" __declspec(dllexport) void ESFreeMem (void* p);
    extern "C" __declspec(dllexport) void ESTerminate (void );
    extern "C" __declspec(dllexport) int AddNumbers(int a, int b);
    extern "C" __declspec(dllexport) char* ESInitialize (TaggedData* argv, long argc)
    return "AddNumbers_dd";
    int AddNumbers(int a, int b)
    return a + b;
    long ESGetVersion (void){
    return 17;
    And the code that I wrote in javascript is:
    var obj = new ExternalObject("lib: mydll.dll");
    var x = obj.AddNumbers(10, 20);
    alert(x);
    The version of the library is correct, but when I try to use the function "AddNumbers" I receive this error "AddNumbers is not function".
    What would be the correct procedure to call a function inside a DLL?

  • How to call external java functions in XSLT Mapping Programs

    Hi All,
    I am unable to call java programs in XSLT MAPPING.
    I tried by following the blog...but getting error :
    XSLT Mapping With JAVA Enhancement ( For Beginners)
    I need some input from you all.
    Waiting For quick reply.
    Rgds Somu.

    i wrote the code...
    and getting error in interface mapping..
    <?xml version="1.0"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:MyLib="java:datetime.DateandTime">
         <xsl:template match="/">
              <Order DocType="OrderCreate" Version="2.0.2">
                   <Header>
                        <RequestingDocumentIdentifier>
                             <DocumentIdentifier>
                                  <xsl:value-of select="concat('IDOC',//EDI_DC40/DOCNUM)"/>
                             </DocumentIdentifier>
                        </RequestingDocumentIdentifier>
                        <RequestingDocumentDateTime>
                             <DateTime DateTimeQualifier="On">
                                            <xsl:if test="function-available('MyLib:getDateValue')">
                       <xsl:value-of select="MyLib:getDateValue()"/>                   
      </xsl:if>
                                        </DateTime>
                        </RequestingDocumentDateTime>
                        <From>
                             <PartnerInformation>
                                   <PartnerName>BASF SA</PartnerName>
                                    <PartnerIdentifier Agency="AssignedByBASF">
                                     <xsl:value-of select="//E1EDK14[QUALF='014']/ORGID"/>
                                    </PartnerIdentifier>
                             </PartnerInformation>
                        </From>
                        <To>
                        <PartnerInformation>
                             <PartnerName>BASF CORP CHEM DIV</PartnerName>
                             <PartnerIdentifier Agency="D-U-N-S">001307032</PartnerIdentifier>
                        </PartnerInformation>
                   </To>
                   </Header>
              </Order>
         </xsl:template>
    </xsl:stylesheet>

  • Calling external DC functions in BPM

    Hi, we need to call an external function defined in another DC than the process. The help states this is possible by defining a namespace. Where do I put that namespace declaration? In what file? XSD?
    http://help.sap.com/saphelp_nwce711/helpdata/en/c3/fdb196a56b41b38bd7215accabba48/content.htm
    You define the namespace prefix of the DC containing the function you want to use, before using the function.
    Example
    You want to use the function u201CExampleFunctionu201D, created in the project u201Cmy.company.com/myProject1u201D. You define the namespace prefix of the DC containing the project in the following way:
    End of the example.
    Syntax
    xmlns:myProject1 ="my.company.com/myProject1"

    Just put the ns definition in the expression editor.
    Then use prefix:function in the next line.
    Thanks Benny.

  • Calling an external C function from a C file in JNI

    Hello,
    I am trying to call an external C function, from a C file which is being called by a Java file. I am getting an unresolved symbol error. I have tried many things like, making the external C function in the format of JNI, etc, etc. It is still not working. I think it has something to do with linking the two C files. If anyone can please answer this, it would greatly help me. here is the code:
    HelloWorld.c:
    #include <jni.h>
    #include <stdio.h>
    #include "MyOldHello.h"
    #include "HelloWorld.h"
    JNIEXPORT void JNICALL
    Java_HelloWorld_print(JNIEnv *env, jobject obj)
         helloPrint();
         return;
    HelloWorld.java:
    class HelloWorld
         private native void print();
         public static void main(String[] args)
              new HelloWorld().print();
         static
              System.loadLibrary("HelloWorld");
              System.loadLibrary("MyOldHello");
    MyOldHello.c:
    #include <jni.h>
    #include <stdio.h>
    #include "MyOldHello.h"
    void helloPrint()
         printf("\nHello World!\n");
    MyOldHello.h:
    void helloPrint();
    Now i use the Visual C++ command prompt to compile this by saying:
    javac HelloWorld.java
    javah -jni HelloWorld
    cl -Ic:\Java\jdk1.6.0_20\include -Ic:\Java\jdk1.6.0_20\include\win32 -MD -LD HelloWorld.c -FeHelloWorld.dll
    and now it gives me the error saying that there is an unresolved external symbol, which is the call to helloPrint in the file HelloWorld.
    If anyone knows how to solve this, or how to call external C functions from a C file that is being called from a Java file using JNI, please respond.
    Thanks
    Nick

    Hi,
    In your post on velocity review, you did not compile MyOldHello.c. You compiled a C file that included the header file for it and called a method defined in the header. The linker is never going to be able to find the code for this if you do not include the object file for this.
    Try this. You will also have to add in any JNI libraries you need to link against but I am sure you could work that out.
    cl /c MyOldHello.c
    cl /c -Ic:\Java\jdk1.6.0_20\include -Ic:\Java\jdk1.6.0_20\include\win32 -MD HelloWorld.c
    cl /LD MyOldHello.obj HelloWorld.obj /FeHelloWorld.dll
    [http://msdn.microsoft.com/en-us/library/f35ctcxw(VS.80).aspx]
    Cheers,
    Shane

  • How to call external Java code from Animate project?

    I am creating a trainer using Animate that needs to interface with an aircraft model written in Java.  Is there a way to call external Java functions from Animate?
    Thanks!

    you can import external java files by yepnope
    yepnope({nope:[
                                  'your java script file address.js',
                             ],complete: init});
    function init() {
    codes that work with your js file can be write in here
    Zaxist

  • How to call external functions without a .DLL (just using a .H and .LIB file)?

    Hello everyone,
    actually I'm facing little difficulties on how to get an external function getting called from within CVI (Version 2009).
    I was supplied with a .H file and a .LIB file to call an external function from within my CVI project. The .H file looks like this:
    void exportedFunction(double *parameter);
    As far as I know, the external function was written with MS Visual C++ 6.
    So I tried to statically link to the extern al function like this:
    - Add the .H file and the .LIB file to the CVI project
    - #include the .H file where I needed to call the external function
    - do the external function call
    When building I get an unresolved external function call error from CVI so this seems not to be working.
    I made some searches around and got up with two possible issues. Maybe one of you can help me get a bit further and get things working.
    1) The "real" function code is located in the DLL file which was not delivered to me. Or is there a way to get things done (call external functions) just with a .H and a .LIB file (without any .DLL file included)?
    2) The external function does not export according to "C-Style" rules. The function signature in the .H file shows no things like
    extern "C" __declspec(dllexport) void __stdcall ...
     Or maybe it's a combination of both issues (missing .DLL + wrong export style of function)?
    I guess I could get around the wrong export style of the function when I manage to write a wrapper around the original function that actually uses C-Style exporting. But I guess I need the .DLL file for this try as well.
    Thank you for your answers.
    Best regards,
    Bernd
    Solved!
    Go to Solution.

    There is no need  for the dllexport stuff. There is also the option for a static library without any DLL.  But the 'extern "C"' is essential, because it forces the C++  compiler, which was probably used to compile the library , to use C calling convention.
    If you can't ask the provider of the library to provide a version which was compiled using C calling convention the way to go is to write a wrapper with VC++6 around that library which reexports the functions using C calling convertion. Something like
    extern "C" type0 myfunc1(type1 arg1, ...) {
           return func1( arg1,...);
    for every function , you need to use.
    BTW. "unresolved symbol" is the linker error message, you can expect if you try to link C code against a library build with C++ calling convention.

  • Crash "DAbort 0x37C03D in MemoryMana​ger.cpp" when calling DLL with "Call Library Function Node"

    Hi all,
    I would like to work with a LabVIEW program that I did not programm by myself.
    In this programm an external DLL needs to be called. in the Momente this dll ist called with the "Call Library Dunction Node" LabVIEW crashes with this Error Message:
    DAbort 0x37C03D in MemoryManager.cpp
    Attached is the entire Log.
    The programm runs on the computer of the original programer.
    I have never handeled with DLLs or something like that before, so I have absolutely no idea how to rsolve this problem.
    Thanks for your help!
    Attachments:
    lvlog.txt ‏2 KB

    A DLL can be compiled by different compilers. By "generic" C DLL, i refer to ANSI C (so no C++, no Borland C or something else).
    My question is raised as parameters, esp. arrays and strings, can lead to this behavior when used in the wrong way (including "Calling Convention").
    Also, interfacing with the LV memory manager can lead to crashes like this, but this wouldn't be a "generic" DLL as it binds to LV (due to LV API calls).
    Without a better knowledge on the DLL and its functions, there is not much we can help you with.
    Where does the DLL come from?
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • 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

  • How to call a dll with special parameters in Labview?

    Hi,
    I have a dll file (compiled in C++) and I would like to call the individual functions from this dll file.
    I do not know however, how I must correctly define the initial parameters in LabView.
    That is the function, which I would like to call:
    DWORD OpenDiagDriver ( char* port,
    LPCSTR path,
    CANObjects CANObj[],
    WORD BitTiming = 0x4167);
    CANObjects CANObj[] is a pointer to array with CAN configuration data
    typedef struct
    DWORD Ident;
    BYTE Config;
    }CANObjects;
    CANObj[0].Ident= 0x18DA0000;
    CANObj[0].Config= 0x8C;
    CANObj[1].Ident= 0x18DA0000;
    CANObj[1].Config= 0x84;
    WORD BitTiming= 0x4167;
    I made a vi, but it doesn’t work.
    Attachments:
    example.vi ‏29 KB

    Hard to say without the full C source. Are you building the DLL according to the CIN rules (see Using External Code in LabVIEW)? Mapping clusters to C code in DLLs is not a simply process and we generally recommend to create wrappers. However, since your structures are fairly straightforward, you could use the "Adapt to Type" as you are trying to do.
    I recommend checking out the mentioned manual and also the examples in \examples\dll\data passing\Call Native Code.llb and the associated C files.
    Brian Tyler
    http://detritus.blogs.com/lycangeek

  • PDA: How does the VI in the "Calling External Code (Inline C Method)" example link to the called functions?

    The PDA module provides an example of calling external code via an inline C
    The inline source code from the example:
         OSVERSIONINFO info;
         info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
         Err = GetVersionEx(&info);
         MajorVersion = info.dwMajorversion;
         MinorVersion = info.dwMinorversion;
    The PDA build specification includes *no* additional source files of any kind.  The only source file in the build is the top-level VI.  Where are the definitions for the OSVERSIONINFO type, and the GetVersionEx function drawn from?
    The VI builds and runs fine on the PDA, but I don't understand how.

    Donovan B wrote:
    Hi Dan,
    It looks like there is an OSVERSIONINFO struct and GetVersionEx function available in the coredll.lib for the application to call on a PDA running Windows Mobile 5.0.  On both operating systems, it looks like the GetVersionEx function is defined in winbase.h, so I am not sure if there is some kind of linking between the two or if the header file is automatically included when building the executable or not.  Let me do some more research and I'll let you know.
    The information for the function on Windows Mobile can be found here.
    Message Edited by Donovan B on 12-19-2007 06:33 PM
    While the API functions are mostly the same for Windows Mobile and normal Windows the actual implementation and compilation is obviously not and there is no need for that. Windwos Mobile is typically (not sure if there are other versions at all) ARM based, while the desktop version is x86 based. A huge difference.
    And when LabVIEW creates a PDA executable it mostly creates a bunch of hidden C files, invokes the Visual C for Windows CE
    tool chain and lets it create the executable. The Visual C for Windows CE tool chain comes with its own import link libraries for accessing WinAPI functions and those import link libraries reference the functions in the DLLs as they are implemented for Windows Mobile (CE). There is no kernel32.dll in Windows Mobile and why should it? You can't move normal Windows code that would expect that DLL to Windows Mobile anyhow, since it has a completely different CPU and there is always a complete recompile with the Windows CE toolchain necessary anyhow.
    Rolf Kalbermatter   
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

Maybe you are looking for

  • Every time I try to open the firefox application, it won't load and pages and the application freezes. How can I fix this?

    When I open the application, there is one tab that says, "Connecting..." After several seconds, the program crashes and remains that way until I force quit the application. I tried restarting my computer. I also tried uninstalling and reinstalling fi

  • How to find the objects in an application

    Hi We are trying to increase the performace of our server During testing we observed that the memory usage is increasing , we wanted to know what are the objects are created at any time Is there any way to do this , and are there any opensource tools

  • Flash Skin not showing up on website

    Hello, I am having what seems to be a common problem, but am not having any luck with any of the solutions I have tried. I have created a video, gone through the steps in flash cs3, and made the corresponding .swf and .flv files. I publish preview -

  • Keyword Substitution mode

    Hello all, What is Keyword Substitution mode in Eclipse? It has two options Ascii vs Binary..How are they different? Thanks

  • Are you able to download latest Flash Player?

    I am unable to download the latest Flash Player (Version11.3.300.265.  I have followed all the trouble-shooting suggestions offered by Adobe and even chatted with an online assistant (who said I must first purchase a $39 technical support agreement).