Calling external proceedures

I try make the external routine writen in C. Function writen in C and stored in D:\extproc\zzz1.dll
I make the library and function
CREATE or replace LIBRARY externProcedures AS 'D:\extproc\zzz1.dll'
create or replace function pls_max(x binary_integer)
return binary_integer as
external library externProcedures
name "find_max" language C parameters (x long);
Then i execute SQl: select pls_max(10) from dual;
And got the error
ERROR at line 1:
ORA-06521: PL/SQL: Error mapping function
ORA-06522: Unable to load symbol from DLL
Anyone have any idea how to solve this problem? Iv heard about using the following code
#ifdef __cplusplus
extern "C" {
#endif
and
#ifdef __cplusplus
#endif
around the external function. But to be honest this confuses me more. What external function and how does it go around it?
For the sake of my sanity, does anyone have any ideas?
Kind Regards
Richard Clayton

hi i am ashutosh i am too having a similar kind of problem
this is what i did
MY CPP FILE
# include <conio.h>
# include <stdio.h>
#include "dlltest.h"
#define MAXMODULE 50
char module[MAXMODULE];
extern "C" __declspec(dllexport) int NumberList()
{       //GetModuleFileName(NULL, (LPTSTR)module, MAXMODULE);      
printf("\n\nThis function was called from ");
          printf("NumberList(): ");
          for(int i=0; i<10; i++)
          {      printf("%d ",i);
          printf("\n\n");
          return int(10);
extern "C" __declspec(dllexport) int LetterList(int x)
{       //GetModuleFileName(NULL, (LPTSTR)module, MAXMODULE);      
printf("\n\nThis function was called from ");
          printf("LetterList(): ");
for(int i=0; i<26; i++)
     {       printf("%c ",char(97 + i));
} printf("\n\n");
     return 10;
HEADER FILE
#ifdef __cplusplus
extern "C" {
#endif
extern "C" __declspec(dllexport) int NumberList();
//int NumberList();
#ifdef __cplusplus
#endif
#ifndef DLLTESTH_
#define DLLTESTH_
#include <iostream.h>
#include <stdio.h>
#include <windows.h>
extern "C" __declspec(dllexport) int LetterList(int);
#endif
NOW I WANT TO CALL THE NumberList FUNCTION IN MYDLL.DLL FILE FROM ORACLE
SO THIS IS WHT I DID
CREATE OR REPLACE LIBRARY nt_kernel
AS
--'c:\winnt\system32\MYDLL.dll';
'E:\DLL\MyDLL\Debug\MYDLL.dll';
CREATE OR REPLACE PACKAGE disk_util
AS
FUNCTION get_disk_free_space
-- (X OUT PLS_INTEGER)
RETURN PLS_INTEGER;
PRAGMA RESTRICT_REFERENCES (get_disk_free_space,WNPS, RNPS, WNDS, RNDS);
END disk_util;
CREATE OR REPLACE PACKAGE BODY disk_util
AS
FUNCTION get_disk_free_space
--(X OUT PLS_INTEGER)
RETURN PLS_INTEGER
IS EXTERNAL
LIBRARY nt_kernel -- our library (defined previously)
NAME "NumberList" -- name of function in kernel32.dll
LANGUAGE C -- external routine is written in C
CALLING STANDARD PASCAL -- uses Pascal parameter convention
PARAMETERS -- map PL/SQL to C parameters by
-- position
(RETURN int);
END disk_util;
CREATE OR REPLACE PROCEDURE TEMP
AS
lX PLS_INTEGER;
return_code PLS_INTEGER;
BEGIN
return_code := disk_util.get_disk_free_space ();
DBMS_OUTPUT.PUT_LINE('free disk space, megabytes = ' || to_char(return_code));
END;
*********WHEN I EXEC TEMP THE FOLLOWING ERROR SHOWED UP
SQL> EXEC TEMP;
BEGIN TEMP; END;
ERROR at line 1:
ORA-06521: PL/SQL: Error mapping function
ORA-06522: Unable to load symbol from DLL
ORA-06512: at "MNE.DISK_UTIL", line 0
ORA-06512: at "MNE.TEMP", line 6
ORA-06512: at line 1

Similar Messages

  • Error in calling External web service from soa suite 11.1.1.3

    Hi
    I am getting following error while calling external web service......
    ####<Jan 20, 2011 6:54:26 PM IST> <Warning> <oracle.integration.platform> <in-mum-adina05> <soa_server1> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <BEA1-490B9BABECE372A277DF> <24b9eca72eaaa6a3:-4bc6fb7c:12da206ca2c:-7ffd-0000000000006287> <1295529866047> <SOA-20136> <WS Binding: exception durign SOAP invocation: java.util.NoSuchElementException>
    ####<Jan 20, 2011 6:54:26 PM IST> <Warning> <oracle.soa.mediator.common> <in-mum-adina05> <soa_server1> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <BEA1-490B9BABECE372A277DF> <24b9eca72eaaa6a3:-4bc6fb7c:12da206ca2c:-7ffd-0000000000006287> <1295529866047> <BEA-000000> < Payload after BaseActionHander.requestMessage :{parameters=oracle.xml.parser.v2.XMLElement@bd2382}>
    ####<Jan 20, 2011 6:54:26 PM IST> <Warning> <oracle.soa.mediator.common> <in-mum-adina05> <soa_server1> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <BEA1-490B9BABECE372A277DF> <24b9eca72eaaa6a3:-4bc6fb7c:12da206ca2c:-7ffd-0000000000006287> <1295529866063> <BEA-000000> < Properties after BaseActionHander.requestMessage :{ReferenceInstance=[email protected]63ea5,
    ####<Jan 20, 2011 6:54:29 PM IST> <Error> <oracle.webservices.service> <in-mum-adina05> <soa_server1> <[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'> <<anonymous>> <> <24b9eca72eaaa6a3:-4bc6fb7c:12da206ca2c:-7ffd-0000000000006287> <1295529869375> <OWS-04115> <An error occurred for port: FabricProvider: javax.xml.rpc.soap.SOAPFaultException: oracle.fabric.common.FabricInvocationException.>
    I am able to hit external ws from soap ui and getting response but while calling from soa suite getting this error.
    Any clues?
    Thanks
    Vibhor

    WS Binding: exception durign SOAP invocation: java.util.NoSuchElementException
    Looks like the error is in the data sent to or expected from the service in your composite. Check that audit logs and composite flow to make sure your soap message when using soapui matches what you are working with in soa suite.

  • How to call external Perl routines from Pl/SQL - Urgent

    Available software in the Test Environment:
    1. Sun Unix 2.8
    2. Oracle 8.1.7 ( 8i)
    3. Perl 5
    Iam trying to call/execute perl scripts from PL/SQL using the DEMO_RDBMS.mk. I am able to call C scripts from PL/SQL, but actually want to call Perl scripts.
    The steps followed for for C are -
    1. Create and compile a simple C program to execute a unix command (eg., touch a file).
    2. Make a shared library of the above compiled program (object), i.e., load the compiled object module into a dynamic load library.
    3. Declare the above library in Oracle using SQL*Plus.
    4. Define a PL/SQL function or procedure to call the external routine.
    5. Test the external routine.
    The above steps run good for a C program, but step 2 fails when run for a Perl script.
    When I tried to use the following command for step 2 -
    make -f $ORACLE_HOME/rdbms/demo/demo_rdbms.mk extproc_callback \
    SHARED_LIBNAME=cmd_lib.so \
    OBJS=tst_cmd.pl
    got the following error -
    ld: fatal: file tst_cmd.pl: unknown file type.
    ld: fatal: File processing errors. No output written t cmd_lib.so
    *** Error code 1
    This gives me an indication that demo_rdbms.mk does not understand/interpret Perl scripts. Going through the demo_rdbms.mk suggests the same.
    My questions is - How do we call external Perl scripts/routines from PL/SQL ??
    Do I have to get a different version of "demo_rdbms.mk" ?
    PS: The perl scripts used above (tst_cmd.pl) is error free and works as intended in the unix environment.

    Iam trying to call/execute perl scripts from PL/SQL using the DEMO_RDBMS.mk. I am able to call C scripts from PL/SQL, but actually want to call Perl scripts. Well, C is a "compiler" language and Perl is interpreted. In a sense, C is not "scripts".
    When I tried to use the following command for step 2 -
    make -f $ORACLE_HOME/rdbms/demo/demo_rdbms.mk extproc_callback \
    SHARED_LIBNAME=cmd_lib.so \
    OBJS=tst_cmd.pl
    got the following error -
    ld: fatal: file tst_cmd.pl: unknown file type.
    ld: fatal: File processing errors. No output written t cmd_lib.soI guess this compiles an extproc "stub" with your object file, generating an external procedure. So the object file really needs to be an object file :-)
    My questions is - How do we call external Perl scripts/routines from PL/SQL ??I'd guess you need an embedded Perl interpreter in the external procedure.
    Not much help though I'm afraid :-/
    Cheers
    Fredrik

  • How to call external js file to custom master page

    Hi all,
    I have created custom master page and i need to call external .js to master page. i tried every aspect of including this in master page. but this js is not running. 
    <script src="test.js" type="text/javascript"></script>
    i have put the above calling js script to head tag. 
    And, When i am running the site, the js file is not loading. 
    How to load this js file to custom master page. 
    Thanks,
    Rakesh

    I have placed js file in same folder of custom master page. 
    This is quite annoying and i am struggling to call it. 
    js file is in same master page folder still i am calling it through whole URL as
    <script type="text/javascript" language="javascript" src="http://SharePoint/sites/SiteName/_catalogs/masterpage/Master%20Page%20Template/test.js"></script>
    Still it is not working.
    Now i am not sure what is wrong here. 
    Please help..
    Thanks in adv !!
    Rakesh

  • 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.

  • I want to call External Java class from the PL/SQL

    Hi,
    I am using Oracle Apps R11i (11.5.7), I wanted to call external Java class from the PL/SQL. This external Java class is residing in another application server.
    How do I do this.
    I know one way. Develop C routine in Oracle Apps to call external java class and call this C routine from the PL/SQL.
    Is there any simple method available? or any other method?
    Thanks in advance.
    -Venkat

    First of all, this is a Java application you're talking about, right (i.e. it has a main() function)? It's not just a class that you're trying to instantiate is it? If it's an application, you obviously have to start a new virtual machine to run it (rather than using the virtual machine built into the database like stored java). I'm a little leary of your mention of an "application server" as this would more commonly mean that a virtual machine is already over there running with access to this class. In which case, you'd typically interface with SOAP or some other RPC API.
    All that aside, as long as you have physical disc access (through NFS or whatever) to the class file, you could use a java wrapper class with a system call to do this. In fact, there is a thread in just the last day or so on this very forum that has the code to do just that (see " Invoking OS Commands from PL/SQL"). However, it's worth noting that the virtual machine will be running on the database server in this case and not the application server.

  • How to call external files from java?

    How to call external files in java. For example how to call a *.pdf file to open in its default editor(say Acrobat), or a *.html file to open in the default browser or a *.txt file in a notepad etc..,
    In my program i have *.chm (Compiled Windows HTML Help) help file. how to open it in its default editor it?

    Jayarathina_Madharasan wrote:
    no one answered my questionHi what wrong did i do...basically insulted all the volunteers here who took the time to consider your question and try to offer you help. Other than that, you did nothing wrong.
    From JavaRanch :
    And even if an answer doesn't solve your problem, even if it should totally miss the point - the best thing to do to motivate others to continue trying to help you is showing respect and gratitude for the investment of time that was put into dealing with your issue.
    Edited by: Encephalopathic on Apr 14, 2008 10:01 AM

  • How to call external programs?

    I have seen people call external programs through LabVIEW and was curious what functions you could use to do this.
    I'm pretty sure its using one of the ActiveX functions  or maybe 'open application reference .vi'.
    Can anyone tell me (or show me) a quick example of how to open an external program (ie excel,  notepad, etc) programatically
    Cory K
    Solved!
    Go to Solution.

    Cory K wrote:
    Where did they get this:
    Kudos for going from "I don't know to start" to "Let's stump Ben" with only the second post to this thread.
    I either copy it from an example or try to browse to it.
    NOTE:
    If you plan to work with MS ActiveX objects, I found it very helpful to do a custom install of Office and make sure the help files for VBA are loaded. These will at the least give you an idea of what the methods are and what parameters go with each.
    Ben
    Message Edited by Ben on 12-31-2008 11:09 AM
    Message Edited by Ben on 12-31-2008 11:13 AM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction
    Attachments:
    Browse.PNG ‏24 KB

  • 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

  • When importing a flash animation into captivate flash will not call external files

    Is there a way to import flash into captivate and it still be able to call external files (ie. sound, video xml)? When I import flash into captivate it will not call any external file.

    Hi all
    Wow, I was so hoping fellow Adobe Community Expert Paul Dewhurst would pop in on this thread.
    Why? Well, Paul sent me a way cool gizmo a while back that hacked the Info button. It used an external file for some of the information! So somehow Paul managed to sort what it took to insert a Flash object into Captivate and have that object extract data from an externally located file.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • Problem in Calling External Procedure

    Hello,
    I am trying to call external procedure written in C from PL/SQL.
    Here are the codes :
    For external procedure:
    #include<stdio.h>
    void extproc_fn ( void )
    FILE * file_handle;
    if (( file_handle = fopen ( "/root/cprogs/extproc.out", "a" )) != NULL )
    fwrite ( "External Procedure Testing", 26, 1, file_handle );
    fclose ( file_handle );
    I have created library as :
    create or replace library extproc_lib as '/root/cprogs/extproc.so';
    And the procedure :
    create or replace procedure extproc_proc as
    external
    name "extproc_fn"
    library extproc_lib
    language c;
    My listener and tnsname is configured correctly.
    But when I try to connect to Oracle by that tnsname, extproc program core dumps under $ORACLE_HOME/network/log directory. Under WinNT, it creates a Dr. Watson error.
    Any idea what might have gone wrong.
    Thanks in advance.
    Soumen Ghosh

    hi there,
    everything u did is correct as far as i recollect about external procedures ,the only thing that i suppose is missing is that u forgot to grant permissions on the library to the user...pls check this once i hope this works...
    bye
    Atul

  • 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

  • Create an SAP Web Service Consumer (calling External Sharepoint Web Service from ABAP)

    hi all,
    i am trying to
    Create an SAP Web Service Consumer (calling sharepoint Web Service from ABAP) using blog given on following link
    Create an SAP Web Service Consumer (calling External Web Service from ABAP) 
    but when i am using my url at the end of step 3, i am getting error as follows:
    i dont want to use local file option. Can anyone help me in this??
    thanks in advance
    regards,
    SDS

    Hi SDS,
    you recieved a http 404 error when trying to access the Sharepoint Web service. Http 404 indicates that the resource is not reachable (cf. HTTP 404 - Wikipedia, the free encyclopedia). There could be different reasons for that. I'd suggest rubble checking the URL of the Web service first. Try to access it from a browser on you desktop. If the URL is correc. Most likely the SAP system is not able to connect to the URL. This could, for example, be due to some firewall restrictions. You should ask a SAP Basis colleague if they are able to access the URL of the Web service from the server on which the SAP system is running.
    Christian

  • How can I call external exe in java

    Hi ,
    Is It Possible to call external exe in java.
    I read Runtime.exe("some exe") but actually my exe expects some input to process for that how can i pass the input to my exe and how can get the response from exe to my java class.
    any sample code is welcome.
    Thanks
    Babu H

    example
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.KeyAdapter;
    import java.awt.event.KeyEvent;
    import java.io.*;
    public class RuntimeExample extends JFrame {
        private JTextArea textArea;
        private JTextField textField;
        private PrintWriter writer;
        public RuntimeExample()
            init();
            initProcess();
        public void init()
            textArea = new JTextArea(20, 80);
            textArea.setEditable(false);
            textField = new JTextField(30);
            textField.addKeyListener(new KeyAdapter()
                public void keyPressed(KeyEvent event) {
                    if (event.getKeyCode() == KeyEvent.VK_ENTER)
                        if (writer != null)
                            textArea.setText("");
                            writer.print(textField.getText() + "\r\n");
                            writer.flush();
                            textField.setText("");
            Container container = getContentPane();
            JScrollPane scrollPane = new JScrollPane();
            scrollPane.setViewportView(textArea);
            container.add(scrollPane, BorderLayout.CENTER);
            container.add(textField, BorderLayout.SOUTH);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            pack();
            textField.grabFocus();
            setVisible(true);
        public static void main(String[] args) {
            new RuntimeExample();
        public void initProcess()
            Runtime rt = Runtime.getRuntime();
            try
                //Process p = rt.exec(new String [] {"cmd", "/C", textField.getText()});
                //textArea.setText("");
                //textField.setText("");
                Process p = rt.exec("cmd");
                writer = new PrintWriter(p.getOutputStream());
                Thread thread1 = new Thread(new StreamReader(p.getErrorStream()));
                Thread thread2 = new Thread(new StreamReader(p.getInputStream()));
                thread1.start();
                thread2.start();
                System.out.println("Exit Value = " + p.waitFor());
            catch (Exception ex)
                textArea.append(ex.getMessage());
                ex.printStackTrace();
        public class StreamReader implements Runnable
            InputStream is;
            public StreamReader(InputStream is)
                this.is = is;
            public void run()
                try
                    BufferedReader reader = new BufferedReader(new InputStreamReader(is));
                    String data;
                    while ((data = reader.readLine()) != null)
                        textArea.append(data + "\n");
                    reader.close();
                catch (IOException ioEx)
                    ioEx.printStackTrace();
    }you can pass input to the exe by using getOutputStream() from Process and get the output from getInputStream() from Process

  • Call External Javascript file in Custom Visual WebPart

     Hi..
     How to call external javascript file in Custom Visual WebPart in sharepoint 2010
    Ravindranath

    Hello,
    Download that script and save in layout folder or within a site. Then use below script tag in webpart:
    <SharePoint:ScriptLink ID="ScriptLink2" Name="location/jquery-1.5.min.js" runat="server" OnDemand="false" Localizable="false" />
    http://stackoverflow.com/questions/5068663/how-to-call-an-external-javascript-file-from-a-webpart
    http://stackoverflow.com/questions/5243821/external-javascript-file-in-sharepoint-web-part
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

Maybe you are looking for