[iPhone] Calling Objective-C function from a standard-C function

How can I call an Objective-C function from a standard-C function?
I can call standard-C functions from an Objective-C functions but I can't do the inverse, how can I solve the problem of the *error: 'self' undeclared* ?
Here below is the example code:
- (void)animateView: (UIImage *)image fromPosition:(CGPoint) location1 toPosition:(CGPoint) location2
- (void) touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event
[self animateView:newImage fromPosition:location1 toPosition:location2];
void dessineItemesAnim(int iteme, int final)
[self animateView:newImage1 fromPosition:location1 toPosition:location2];
*error: 'self' undeclared (first use in this function)*
}

Either add another parameter that contains a reference to the instance you are trying to call (just like many of the various API functions that use a 'C' language callback offer a 'user data ' parameter that can be used for this purpose) or create a global variable reference to the instance.
Once you have the instance reference, then you can use it in the same way that you would from within an obj-c function.
Of course, all of this assumes that you are using the standard GCC compiler that is told that your source is objective-c.
Susan

Similar Messages

  • Calling a object of class from other class's function with in a package

    Hello Sir,
    I have a package.package have two classes.I want to use object of one class in function of another class of this same package.
    Like that:
    one.java
    package co;
    public class one
    private String aa="Vijay";  //something like
    }main.java:
    package co;
    import java.util.Stack;
    public class main extends Stack
    public void show(one obj)
    push(obj);
    public static void main(String args[])
    main oo=new main();
    }when I compile main class, Its not compile.
    Its give error.can not resolve symbol:
    symbol: class one
    location: class co.main
    public void show(one obj)
                              ^Please help How that compile "Calling a object of class from other class's function with in a package" beacuse I want to use this funda in an application

    kumar.vijaydahiya wrote:
    .It is set in environment variable.path=C:\bea\jdk141_02\bin;.,C:\oraclexe\app\oracle\product\10.2.0\server\bin;. command is:
    c:\Core\co\javac one.javaIts compiled already.
    c:\Core\co\javac main.javaBut it give error.
    Both java classes in co package.Okay, open a command prompt and execute these two commands:
    // to compile both classes:
    javac -cp c:\Core c:\Core\co\*.java
    // to run your main-class:
    java -cp c:\Core co.main

  • How to distinguish the User-Defined-Function from Oracle Build-In function

    Hi Friends,
    I could get the function list form all_objects table by the SQL:
    select * from all_objects where object_type = 'FUNCTION'
    but there is no column in all_objects specify the function is build-in or user-defined.
    But I found in SQL Server there is a column "is_ms_shipped" in the sys.all_objects table. This column will specify the object is build-in or user-defined. I want to get the equivalent column in Oracle but failed.
    Could anyone tell me how to solve this problem?
    Thanks,
    Ricky

    Thanks Pavan.
    But if an user connects to database using "conn /as sysdba" syntax and creates a function. This user-defined funtion goes into the "SYS" schema also. I know it is not the best practise to create objects using sys user so I think your solution is right.
    Regards,
    Ricky

  • Calling WebDynpro input screen from within an abap Function module / user

    Hi,
    I am posting SAP data with a BAPI from an Web Dynpro Application.
    In the Bapi I must use an BADI/User -EXIT to add some infornation.
    Today this is done by calling an Dynpro in a function module. This creates a pop up, data is filled and posted on commit.
    How can I get a Web Dynpro application to display this popup without showing the "call screen without connection " error ?
    Thanks for any help.
    Marcus

    >
    Deok-Byung Lim wrote:
    > Here is an unofficial way to get current WD component.
    > (WDR_TASK class is not for customer)
    >
    >   DATA lo_wdr_component TYPE REF TO cl_wdr_component.
    >   lo_wdr_component = wdr_task=>application->component.
    >
    >
    > then.. attach component usage and popup your WD screen
    >
    > BUT IT'S NOT OFFICIAL!!
    This approach is absolutely NOT supported nor recommended by SAP.

  • Calling a C Struct from a LV CallLibrary Function.

    I have a DLL called Canopen.dll.
    I have an example C-Code on how to use the functions in the DLL.
    Have been able to call a few of the functions in LV using the Call Library Function.
    But one function is a problem as its arguments are from a Struct. It goes like this:
    Function Call
    short CMA_ConfigCANChannel(
    unsigned char usChannelHandle,
    CMA_CAN_CONFIG stCANConfig);
    Parameter List
    typedef struct
    unsigned char ucBaudrate;
    unsigned char ucPresc;
    unsigned char ucSjw;
    unsigned char ucTSeg1;
    unsigned char ucTSeg2;
    unsigned char ucAccCode;
    unsigned char ucAccMask;
    } CMA_CAN_CONFIG;
    Now how to convert this to be suitable fro CallLibrary Function ?? (  Actually there is one example in the NI site but that is in LV5.0 and my LV2009 cannot open it !!)
    Thanks
    Raghunathan
    LV2012 to Automate Hydraulic Test rigs.

    How to handle int array  and string array inside a C structure to call it from LV call library function?
    Function:
    short CMA_GetVersion( unsigned char ucChannelHandle, CMA_VersionStruct *stpVersion);
    C Structure:
    typedef struct
    unsigned long ulHWSerialNumber;
    unsigned char ucHWMainRevision;
    unsigned char ucHWSubRevision;
    unsigned char ucHWIdentString[18];
    unsigned char ucSWMajorVersion;
    unsigned char ucSWMinorVersion;
    unsigned char ucSWBuild;
    } CMA_VersionStruct;
    Function:
    short CMA_InstallPDO_E( unsigned char ucChannelHandle, CMA_PDOConfig, unsigned short *uspPDOHandle);
    C Structure:
    typedef struct
    unsigned char ucPDOType;
    unsigned long ulCOBID;
    unsigned char ucTransType;
    unsigned char ucAccType;
    unsigned char ucEventNotif;
    unsigned char ucaDefVal[8];
    unsigned short usEventTimer;
    unsigned char ucNrOfByte;
    unsigned char ucNoInitTrans;
    } CMA_PDOConfig;
    Hope someone helps.
    Thanks
    Kousy

  • PDF with javaScript function from Pro, not fully functional in Reader

    Hi,
    I followed recommendations to set up a button and apply a javaScript so that when end-user clicks on button, they can upload an image and then save the PDF.
    However, in Reader, the file extension drop-down is locked and forces end-user to only have the option of selecting a PDF as their image. I was going for JPG or GIF here at the very least.
    Is there anything else I could do, or am I stuck? In Pro, the drop down presents a wide array of file types in which to select from...
    Thank you!

    Adobe Reader can only insert PDF files as images. Adobe Reader can't convert other files.

  • How to access function from Top Class to Function of class that contain the the member variable of TopClass

    Dear All,
    is there any way that i can access function or member variable of aggregate class.
    i am working in Visual Studio 2010 
    and making win32 dll with mfc Support. i am new in dll system. just learning and doing.
    previously all in exe and i am working this like
    CTestDoc*pDoc = (CTestDoc*)GetTestDocument();
    somevar = pDoc->xDoc.mVar.GetValue (); 
    now i am trying to put all in dll. so getting problem 
    will i get help on this. thanks in advance.
    below code is just an example.
    for example
    // dll 1
    class aaa : public BaseClass
    public:
    int Index;
    char *cName;
    void doSometing()
    if (GetCurBColor() == 125) // how to access GetCurBColor function of the
    color = GetCurBColor();
    long color;
    // dll 2
    class bbb :public BaseClass
    public:
    int Index;
    long lSize;
    long color;
    void doSometing();
    // dll 3
    class DDD
    public:
    vector <aaa> va;
    vector <bbb> vb;
    int cura;
    int curb;
    long GetCurBColor ()
    return vb[curb].color;
    };// MFC doc/view support
    /// in exe in document
    class inExe
    public:
    DDD d;
    void addB()
    { bbb bb;
    bb.color = 152;
    d.vb.push_back(bb);
    bb.color = 122;
    d.vb.push_back(bb);
    bb.color = 1232;
    d.vb.push_back(bb);
    d.curb = 1;
    void addA()
    { aaa aa;
    aa.color = 152;
    d.va.push_back(aa);
    aa.color = 1232;
    d.va.push_back(aa);
    aa.color = 1542;
    d.va.push_back(aa);
    aa.color = 15;
    d.va.push_back(aa);
    d.cura = 2;
    d.va [1].doSometing ();

    Dear All,
    is there any way that i can access function or member variable of aggregate class.
    i am working in Visual Studio 2010
    and making win32 dll with mfc Support. i am new in dll system. just learning and doing.
    previously all in exe and i am working this like
    CTestDoc*pDoc = (CTestDoc*)GetTestDocument();
    somevar = pDoc->xDoc.mVar.GetValue ();
    now i am trying to put all in dll. so getting problem
    What problem?
    The rules of C++ do not change because some of the code ins in a DLL. But the classes in a DLL need to be exported. See for example
    https://msdn.microsoft.com/en-us/library/81h27t8c.aspx
    You should also supply a macro so that the class header can be used in both the DLL and the client. See for example
    http://stackoverflow.com/questions/14980649/macro-for-dllexport-dllimport-switch
    If  you exchange memory between the DLL and the client (as your example will do, because of the std::vector content), you should also be sure to use the same version of the compiler for each module, and to dynamically link to the CRT.
    I would also advise you to start with a less complicated scenario, with just one DLL.
    David Wilkinson | Visual C++ MVP

  • Put SQL query in a function/ call function from region

    How can I write a SQL query (like SELECT EMPNO, ENAME, JOB FROM EMP) as PL/SQL function, and then call this function from the PL/SQL Function Returning SQL Statement region?
    Thanks, Tom

    thanks jverd for your quick reply.
    I know passing in a reference to an object will do the job if I want to change the value several parameters in one function call.
    But I want to ask, is there any other ways?
    the following code works.....
    public class TestParameter {
         public static void main(String[] args) {
              Test2 t2 = new Test2();
              invokeChange(t2);
              System.out.println("x = " + t2.x + "\t y = " + t2.y);
         static void invokeChange(Test2 t2) {
              t2.x = 10;
              t2.y = 15;          
    class Test2 {     
         int x;
         int y;     
    }

  • To call a custom page from standard page

    Hello ..
    I want to add a button to the standard page and then call my custom page from the standard page on clicking that.. Can anyone tell me the steps for doing so. Also I want to know that creating this submit button will come under personalisation or customisation.
    And how do I make the changes in the controller of Standard page .Do I need to open that standard page in Jdev.
    Plz help.

    Create a button through personalization and set the destination URL thats it.
    Also I want to know that creating this submit button will come under personalisation or customisation.Personalisation
    Thanks
    --Anil
    http://oracleanil.blogspot.com/

  • Call DLL function from JAVA

    HI!
    What's the best way (and simple) to call DLL function from JAVA.
    DLL function (developed in C) has two input parameters (string) and return an integer.
    Could you help with an example?
    Thanks a lot.

    Do a google search for 'JNI tutorial' and it will turn up hundreds of examples.

  • Using function from windows dll in abap program

    Hi
    How can i use a function from a standard  DLL that in c:\winnt\system32.?.
    Ami

    Hello ami,
    here is the solution to your question - I know, a little bit late, but I hope not to late.
    Cheers
    Stefan
    "-Begin-----------------------------------------------------------------
      Report  ZLOGON.
      "-Variables-----------------------------------------------------------
        Data Win32 Type OLE2_OBJECT.
        Data Token Type String Value '0000'.
        Data hToken Type Integer.
        Data phToken Type Integer.
        Data ret Type Integer.
      "-Main----------------------------------------------------------------
        Create Object Win32 'DynamicWrapperX'.
        If Win32-Handle > 0.
          "-Define external functions---------------------------------------
            Call Method Of Win32 'Register' Exporting
              #1 = 'advapi32.dll' #2 = 'LogonUserA'
              #3 = 'i=sssuup' #4 = 'r=l'.
            Call Method Of Win32 'Register' Exporting
              #1 = 'kernel32.dll' #2 = 'CloseHandle'
              #3 = 'i=h' #4 = 'r=l'.
            Call Method Of Win32 'Register' Exporting
              #1 = 'kernel32.dll' #2 = 'GetLastError'
              #3 = 'r=u'.
          Call Method Of Win32 'StrPtr' = phToken Exporting
            #1 = Token #2 = 's'.
          Call Method Of Win32 'LogonUserA' = ret Exporting
            #1 = 'bambi' #2 = '.' #3 = 'hugo' #4 = 2 #5 = 0 #6 = phToken.
          If ret <> 0.
            "-Logon successful----------------------------------------------
              Write: 'Logon as bambi user'.
            Call Method Of Win32 'NumGet' = hToken Exporting
              #1 = phToken.
            Call Method Of Win32 'CloseHandle' = ret Exporting
              #1 = hToken.
            If ret = 0.
              Call Method Of Win32 'GetLastError' = ret.
              Write: / ret.
            EndIf.
          Else.
            Call Method Of Win32 'GetLastError' = ret.
            Write: / ret.
          EndIf.
          Free Object Win32.
        EndIf.
    "-End-------------------------------------------------------------------
    Edited by: Stefan Schnell on Sep 6, 2011 7:07 AM

  • How can i use function from microsoft DLL in an ABAP program?

    Hi
    Is there a way to use a function from a standard DLL file in an ABAP progrm ????
    The dll is stored in c:\winnt\sttem32.
    Do i need to upload the dirver to the ECC server? do i need to put it some Tcode before i use it in my program?
    i tried to fined some clear exaple but without any success .
    Hope to get some help here ,
    thanks ,
    E.

    this is not really possible, a dll cannot be uploaded, eg. sap could run in a non windows-environment so this won't work
    Why not?  You can query the local operating system for type/version, you can detect the presence of a file if you have the access, and you can run local executables using GUI_EXECUTE.  However, if you've got any level of decent security in place, you're not going to be allowed to run a DLL in that location...

  • Calling database stored  function from Entity Object

    Hi,
    I want to call a database stored function from create() method of Entity Object.
    Database function returns some value.
    Can anybody suggest me some way to do it.

    You can try the following:
    make a String whit your function call, I dont know if this is the correct SQL syntax for a function, it should be for a stored procedure.
    String call = "begin; callyourfunction; end;"
    PreparedStatement ps = getDBTransaction().createPreparedStatement(call,0);
    ps.execute();
    ResultSet rs = ps.getResultSet();
    You can now read the data from the function from the rowset.
    Be sure to cleanup the PreparedStatement when your done whit it to avoid open database connections.
    ps.close();ps=null;

  • Cannot call ANY stored functions from my Java program

    My problem is that I cannot call ANY stored procedure from my Java
    program. Here is the code for one of my stored procedures which runs
    very well in PL/SQL:
    PL/SQL code:
    CREATE OR REPLACE PACKAGE types AS
    TYPE cursorType IS REF CURSOR;
    END;
    CREATE OR REPLACE FUNCTION list_recs (id IN NUMBER)
    RETURN types.cursorType IS tracks_cursor types.cursorType;
    BEGIN
    OPEN tracks_cursor FOR
    SELECT * FROM accounts1
    WHERE id = row_number;
    RETURN tracks_cursor;
    END;
    variable c refcursor
    exec :c := list_recs(11)
    SQL> print c
    COLUMN1 A1 ROW_NUMBER
    rec_11 jacob 11
    rec_12 jacob 11
    rec_13 jacob 11
    rec_14 jacob 11
    rec_15 jacob 11
    Here is my Java code:
    import java.sql.*;
    import java.io.*;
    import oracle.jdbc.driver.*;
    class list_recs
    public static void main(String args[]) throws SQLException,
    IOException
    String query;
    CallableStatement cstmt = null;
    ResultSet cursor;
    // input parameters for the stored function
    String user_name = "jacob";
    // user name and password
    String user = "jnikom";
    String pass = "jnikom";
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    try { Class.forName ("oracle.jdbc.driver.OracleDriver"); }
    catch (ClassNotFoundException e)
    { System.out.println("Could not load driver"); }
    Connection conn =
    DriverManager.getConnection (
    "jdbc:oracle:thin:@10.52.0.25:1521:bosdev",user,pass);
    try
    String sql = "{ ? = call list_recs(?) }";
    cstmt = conn.prepareCall(sql);
    // Use OracleTypes.CURSOR as the OUT parameter type
    cstmt.registerOutParameter(1, OracleTypes.CURSOR);
    String id = "11";
    cstmt.setInt(2, Integer.parseInt(id));
    // Execute the function and get the return object from the call
    cstmt.executeQuery();
    ResultSet rset = (ResultSet) cstmt.getObject(1);
    while (rset.next())
    System.out.print(rset.getString(1) + " ");
    System.out.print(rset.getString(2) + " ");
    System.out.println(rset.getString(3) + " ");
    catch (SQLException e)
    System.out.println("Could not call stored function");
    e.printStackTrace();
    return;
    finally
    cstmt.close();
    conn.close();
    System.out.println("Stored function was called");
    Here is how I run it, using Win2K and Oracle9 on Solaris:
    C:\Jacob\Work\Java\Test\Vaultus\Oracle9i\FunctionReturnsResultset>java
    list_recs
    Could not call stored function
    java.sql.SQLException: ORA-00600: internal error code, arguments:
    [ttcgcshnd-1], [0], [], [], [], [], [], []
    at
    oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
    at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:889)
    at
    oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:490)
    at
    oracle.jdbc.driver.OracleStatement.getCursorValue(OracleStatement.java:2661)
    at
    oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:4189)
    at
    oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:4123)
    at
    oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:541)
    at list_recs.main(list_recs.java:42)
    C:\Jacob\Work\Java\Test\Vaultus\Oracle9i\FunctionReturnsResultset>
    Any help is greatly appreciated,
    Jacob Nikom

    Thank you for your suggestion.
    I tried it, but got the same result. I think the difference in the syntax is due to the Oracle versus SQL92 standard
    conformance. Your statament is the Oracle version and mine is the SQL92. I think both statements are acceptable
    by the Oracle.
    Regards,
    Jacob Nikom

  • Can we call DMS Attachment Function from ECC to SRM

    Hello All,
    We have the below requirement.
       a)  User Create the RFx(SRM) from PR(ECC) vai CPPR functionality.Now during creation we need to copy the DIR Links of  PR to RFx .
      b) In SRM RFx ,at item level we need to place a button called "DIR" ,when user click on the button , we need to bring the   DMS Attachment POP UP from ECC to SRM , where user can add new DIR or Delete the DIR.
               Can we do the requirement  "b" ? , is there way we can call the "DMS Attachment Function"  from SRM? . Kindly share your thoughts.
    Thanks
    Channa.
    DMS Attachment Function"

    Dear Channa,
    due to your screenshot I saw that you are still working with old object link dynpros.
    To grant that allways the currenct screens and authorizations were called please maintain also the value "1" into the "Authorization" column. For further informations on this maintainance please see the attached note 1066915. It's important that you not enter the mentioned screen number wihtout the leading "1" as this number is added automatically by the system (e.g. object MARA 1201 maintain like MARA 201). You can do this in customizing under:
    Transaction SPRO
    > Cross-Application-Component
         > Document Management
              > Control Data
                  > Define screen for object links
    If you need the dynpro number or object you will find all standard SAP objects and their screen number in function module CV130 (Screens) by transaction SE80. Please maintain all necessary SAP objects.
    Best regards,
    Christoph

Maybe you are looking for