How to maintain reference across native calls?

I'm using JNI to interface with an underlying C++ communications library. I am having trouble keeping my connection valid across native calls.
For example, in one method I connect and save the connection in a global variable, then return. After I connect I would like to call a "send message" method, but when I do I doesn't recognize the saved connection.
My question is do saved references persist across JNI calls when using the same object, or will all global vars be new ones? If not, does anyone know a way to get around this?
Thanks for your help

All JNI references that you create (through calls to NewObject, GetObjectArrayElement, GetObjectField, ...) or that are passed to your native code as parameters are local. That means that they are only valid for the duration of that native call and only on the thread from which that native call was invoked.
You can create global references from local references using NewGlobalRef. A global reference is valid across all threads and does not have a limited lifetime. You must make sure to release your global references once you are done using them by calling DeleteGlobalRef.
God bless,
-Toby Reyelts
Check out Jace, http://jace.reyelts.com/jace

Similar Messages

  • How to maintain pageFlowScope value across 2 japx??

    Hi All,
    How to maintain pageFlowScope values across the pages.
    In my application I got 2 jspx pages where the 1st page (result page) have two page fragments and no fragments in the 2nd page (Master Details page).
    I am triggering the 2nd jspx while clicking the continue button from the 1st jspx's 2nd fragment. I am using Java webservice DataControl in the model layer and both the pages sharing the same WS DC results. In the 2nd fragment I am displaying the user search result. While hitting the continue button I am collecting the selected userID and then triggering the 2nd jspx by passing the that userId thru pageFlowScope, which used to call the WS method once again.
    PageFlowScope losing the context while navigating to 2nd page. It is returning null value. If I remove 2nd page and create the new fragment in the first page itself then the master details is working well.
    Please help me how do I pass the pageFlowScope value from one page to other page without losing the value. I am using faces-config.xml for page navigation.
    Continue button Action method:
    public String userSelected() {
    FacesCtrlHierNodeBinding binding = (FacesCtrlHierNodeBinding) searchResultTable.getSelectedRowData();
    currentRow = binding.getRow();
    selectedNetID = (String) currentRow.getAttribute("netid");
    requestContext.getPageFlowScope().put("netid",selectedNetID);
    return "goToUserMgmt";
    Thanks
    kln

    I am not opening any new window for the 2nd jspx. Trying to open the 2nd jspx in the same window.
    I did the same as you mentioned.
    1) create first page idm.jspx
    2) create 1st page fragment search.jsff (Manually create the input fields...didnt drag and drop the WS DC input).
    3) create 2nd page fragment searchResult.jsff (drag and drop the WS DC result and setting #{pageFlowScope.netid} as value)
    4) create search-task-flow and attaching these 2 frag in it.
    5) Drag and drop the search-task-flow in to first page IDM as region.
    6) Creating 2nd page MasterDetails.jspx (Drag and drop the same WS DC result)
    7) Creating faces-config.xml where I drag and drop both the jspx and setting the navigation rule.
    (If continue from IDM.jspx then go to------>masterDetails.jspx)
    Here the String continue is return by the 1st page--2nd fragment continue button action method...
    This is what I am doing exactly....Any idea please why am I missing the pageFlowScope value!!!
    -kln

  • How the data integrity is maintained between different EJB calls.

    Can anybody pls. clarify on how to maintain data integrity when different business logic components (EJB's) calls different database instance.
    Say client calls Session EJB1 which debits a account
    client calls Session EJB2 which credits another account
    Will the session facade help?. Can we use CMB for this.

    Use Session Facade design pattern.
    SessionFacadeBean {
      transfer() // trasaction attribute for this method shud be RequiresNew or Required
                 lookup(ejb1);
                 EJB1.debit(); // trasaction attribute for this method shud be Required or Supports
                 lookup(ejb2);
                 EJB2.credit(); // transaction attribute for this method shud be Required or Supports
    }

  • ExternalInterface: pass object reference across interface - how?

    I want to invoke methods on specific Javascript or
    ActionScript objects through calls across the ExternalInterface
    barrier. I would like to be able to do this either AS -> JS or
    JS -> AS.
    So I would like to pass an object reference across the
    interface. I'm not sure exactly what *is* getting passed (is it the
    serialized value of the object?), but it doesn't seem to work as an
    object reference.
    Here's a notional code sample. I have two symmetric object
    definitions, one in Javascript, one in ActionScript. During
    initialization, one instance of each object will be created and
    given a pointer to the other. Then they should each be able to
    invoke a method on the other to "do stuff".
    //----------[ code ]---------------------------------
    //--- Javascript ---
    class JSobj {
    var _asObj;
    JSobj.prototype.setASObj = function(obj) { _asObj = obj; }
    JSobj.prototype.callASObj = function(foo) {
    callASObjectMethod(_asObj, foo); } // does: _asObj.asMethod(foo);
    JSobj.prototype.jsMethod = function(bar) { /* do stuff */ }
    function callJSObjectMethod(obj, args) { obj.jsMethod(args);
    //--- ActionScript ---
    class ASobj {
    var _jsObj;
    public function set jsObj (obj:Object):void { _jsObj = obj;
    public function callJSObj (foo:Number):void {
    ExternalInterface.call("callJSObjectMethod", _jsObj, foo); } //
    does: _jsObj.jsMethod(foo);
    public function asMethod (bar:Number):void { /* do stuff */
    function callASObjectMethod (obj:Object, args) {
    obj.asMethod(args); }
    ExternalInterface.addCallback("callASObjectMethod",
    callASObjectMethod);
    //----------[ /code ]---------------------------------
    My workaround is to pass a uint as an opaque handle for the
    object, then resolve it when it is passed back. I'd rather pass a
    real reference if possible. Is there a way to pass object
    references between JS and AS?
    Thanks,
    -e-

    It's an object of a class that extends Object. I guess the answer is no then.
    Thanks for your answer

  • How to maintain Ztable using function module instead of SM30

    Hi Friends,
    please tell me , How to maintain Ztable or view using function module instead of SM30.
    Thanks,
    Veerendra.

    Hi,
    You can design your report and use Function module VIEW_MAINTENANCE_CALL for that.
    You need to use Action type as 'S' for displaying and 'U' for maintaining the table.
    Ex:
    CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
      EXPORTING
        ACTION                               =  'S'
        VIEW_NAME                            =  'Table Name'
    EXCEPTIONS
       CLIENT_REFERENCE                     = 1
       FOREIGN_LOCK                         = 2
       INVALID_ACTION                       = 3
       NO_CLIENTINDEPENDENT_AUTH            = 4
       NO_DATABASE_FUNCTION                 = 5
       NO_EDITOR_FUNCTION                   = 6
       NO_SHOW_AUTH                         = 7
       NO_TVDIR_ENTRY                       = 8
       NO_UPD_AUTH                          = 9
       ONLY_SHOW_ALLOWED                    = 10
       SYSTEM_FAILURE                       = 11
       UNKNOWN_FIELD_IN_DBA_SELLIST         = 12
       VIEW_NOT_FOUND                       = 13
       OTHERS                               = 14.
    Hope this helps.
    Message was edited by: Imtiaz Ahmed

  • How to maintained the Text  language for CKF keyfigure

    Dear All,
    Please let me know how to maintained the text language for CKF I am using only keyfigures in CKF.
    Issue is text is not showing in Spain language when user exeuted the report (longin Spain) for CKF keyfigures .
    As per report design there are formuals and direct keyfigures and CKF has defined and we keep it under in Row struture in the report.
    After exeuted the report (Login Spain)Text has converted in all languages along with spain except for CKF keyfigures.
    Issue in text CKF's:
    There is a main  CKF (Cost) under this again we defined two sub CKF's those are total cost and average cost. We able to see the text in Spain language for Main CKF(cost) and also cheked in RSZELTTXT(Texts of reporting component elements) for the same.
    We can able to see the text in all languages for main CKF(cost) and enteries are there in RSZELTTXT table.
    We can see only  the text in english for  total cost and average cost and also enteris are there only in EN in RSZELTTXT table.
    It would help to me if any one can answer my question.
    Thanks in advance .
    Regards,
    MQ

    U can fetch the texts for the items using
    Read_text.
    Example:
        g_f_tdname = xvttp-vbeln.
        g_f_obj = p_obj.
        g_f_langu = 'DE'.
        REFRESH g_t_lines.
        CLEAR g_t_lines.
        CALL FUNCTION 'READ_TEXT'
             EXPORTING
                  id                      = p_var
                  language                = g_f_langu
                  name                    = g_f_tdname
                  object                  = g_f_obj
             TABLES
                  lines                   = g_t_lines
             EXCEPTIONS
                  id                      = 1
                  language                = 2
                  name                    = 3
                  not_found               = 4
                  object                  = 5
                  reference_check         = 6
                  wrong_access_to_archive = 7
                  OTHERS                  = 8.
        IF sy-subrc <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    The Required fields are,
    Text-id ,language,name,object.
    Let me know if you further require help.
    Regards

  • How to maintain the documents like PDF, EXCEL and WORD in database

    Hi,
    I am working on UI, I am tracking the COREMODS data using this UI. My requirement is need to maintain the related documents also in database using this UI. I think SLM system have that functionality. If any one know about this functionality, explain about
    How to upload the documents into database.
    How to maintain this documents in database.
    Is there any standard methods/function modules to upload this documents ( I am not asking about content of document, I am expecting about total file).
    i.e. I want to maintain the all core mod related test cases and other documents in SAP database.
    How to handle this functionality?
    Rayudu

    hi,
    There is a Utility in SAP called Easy DMS.
    Here you can create folders, maintain authorisations and store your documents.
    Hope this is wht u r looking for.
    Reg,
    Raj

  • How to maintain the data in the view cluster

    we are doing upgrade, we have one view cluster app_log in this object scwb
    and subobjects is swtlo1,02,03 like i have some subobjects in 4.6c we transported the view cluster to ecc6.0 in ecc 6.0 i have object scwb  but subobjects doesn't exist how to maintain the subobjects in view cluster.

    Definition
    A view cluster is a group of maintenance dialogs which are collected in one maintenance unit for business or technical reasons. They allow related data in more than one table/view to be maintained consistently.
    Use
    Whereas only 1:1 relationships can be processed in maintenance views (except for language-dependent texts), key extensions and relationships of cardinality N:M can also be handled in view clusters. Maintenance dialogs with no key, or partial key-dependence, can also be combined into view clusters.
    Grouping dialogs into one maintenance unit has the following advantages for data maintenance:
    Navigation: A view cluster contains convenient standard navigation between the individual maintenance dialogs. This simplifies the maintenance of the data in a view cluster.
    Consistency: The view cluster ensures data consistency when deleting, copying, saving, retrieving and manually transporting data. For example when an entry in a higher-level view is deleted, , it automatically ensures that all dependent entries in lower-level views are also deleted.
    You can first split tables with a lot of fields into various views and then collect them into a view cluster.
    Use tabs to format very wide tables with a lot of fields.
    Structure
    Navigation in a view cluster is usually based on the hierarchy of the tables/views on which the dialogs are based. A view cluster usually consists of one or more root dialogs and the at most 14 maintenance dialogs which depend on them. A view at a lower level has one or more additional fields in its key compared its higher-level view. Each data record at the higher level has several dependent data records below it.
    Each maintenance dialog is an independent unit consisting of an overview screen or an overview and a detail screen, depending on the dialog type. As well as the data to be maintained, the overview screen contains a navigation area, in which you can go to higher or lower level maintenance dialogs.
    One-level maintenance dialogs only contain one screen, the list screen, in which all existing data records are displayed in a table. In a two-level maintenance dialog, double-clicking on a data record in the list screen takes you to the detail screen, which displays all the fields in the selected data record.
    Generate a maintenance dialog for each view before you call the cluster maintenance (SM34). When you generate the maintenance dialog, flag the key fields which are identical in the view and its higher-level in the cluster, with the maintenance attribute S. The system fills the key fields when you go from the upper to the lower level, with the values of the data record selected in the upper level. Go to the transaction SE54 to define a view cluster.
    <b>Rewards point if useful.......</b>
    regards....
    Abhaysingh.

  • How to maintain my Mac

    I'm trying to learn what kind of maintenance do I need to do on my iMac to keep it running good 

    How to maintain a Mac
    1. Make redundant backups, keeping at least one off site at all times. One backup is not enough. Don’t back up your backups; make them independent of each other. Don’t rely completely on any single backup method, such as Time Machine. If you get an indication that a backup has failed, don't ignore it.
    2. Keep your software up to date. In the Software Update preference pane, you can configure automatic notifications of updates to OS X and other Mac App Store products. Some third-party applications from other sources have a similar feature, if you don’t mind letting them phone home. Otherwise you have to check yourself on a regular basis. This is especially important for complex software that modifies the operating system, such as device drivers. Before installing any Apple update, you must check that all such modifications that you use are compatible.
    3. Don't install crapware, such as “themes,” "haxies," “add-ons,” “toolbars,” “enhancers," “optimizers,” “accelerators,” “extenders,” “cleaners,” "tune-ups," “defragmenters,” “firewalls,” "barriers," “guardians,” “defenders,” “protectors,” most “plugins,” commercial "virus scanners,” "disk tools," or "utilities." With very few exceptions, this stuff is useless, or worse than useless.
    The more actively promoted the product, the more likely it is to be garbage. The most extreme example is the “MacKeeper” scam.
    As a rule, the only software you should install is that which directly enables you to do the things you use a computer for — such as creating, communicating, and playing — and does not modify the way other software works. Use your computer; don't fuss with it.
    Never install any third-party software unless you know how to uninstall it. Otherwise you may create problems that are very hard to solve.
    The free anti-malware application ClamXav is not crap, and although it’s not routinely needed, it may be useful in some environments, such as a mixed Mac-Windows enterprise network.
    4. Beware of trojans. A trojan is malicious software (“malware”) that the user is duped into installing voluntarily. Such attacks were rare on the Mac platform until sometime in 2011, but are now increasingly common, and increasingly dangerous.
    There is some built-in protection against downloading malware, but you can’t rely on it — the attackers are always at least one day ahead of the defense. You can’t rely on third-party protection either. What you can rely on is common-sense awareness — not paranoia, which only makes you more vulnerable.
    Never install software from an untrustworthy or unknown source. If in doubt, do some research. Any website that prompts you to install a “codec” or “plugin” that comes from the same site, or an unknown site, is untrustworthy. Software with a corporate brand, such as Adobe Flash Player, must be acquired directly from the developer. No intermediary is acceptable, and don’t trust links unless you know how to parse them. Any file that is automatically downloaded from a web page without your having requested it should go straight into the Trash. A website that claims you have a “virus,” or that anything else is wrong with your computer, is rogue.
    In OS X 10.7.5 or later, downloaded applications and Installer packages that have not been digitally signed by a developer registered with Apple are blocked from loading by default. The block can be overridden, but think carefully before you do so.
    Because of recurring security issues in Java, it’s best to disable it in your web browsers, if it’s installed. Few websites have Java content nowadays, so you won’t be missing much. This action is mandatory if you’re running any version of OS X older than 10.6.8 with the latest Java update. Note: Java has nothing to do with JavaScript, despite the similar names. Don't install Java unless you're sure you need it. Most users don't.
    5. Don't fill up your boot volume. A common mistake is adding more and more large files to your home folder until you start to get warnings that you're out of space, which may be followed in short order by a boot failure. This is more prone to happen on the newer Macs that come with an internal SSD instead of the traditional hard drive. The drive can be very nearly full before you become aware of the problem. While it's not true that you should or must keep any particular percentage of space free, you should monitor your storage consumption and make sure you're not in immediate danger of using it up. According to Apple documentation, you need at least 9 GB of free space on the startup volume for normal operation.
    If storage space is running low, use a tool such as the free application OmniDiskSweeper to explore your volume and find out what's taking up the most space. Move rarely-used large files to secondary storage.
    6. Relax, don’t do it. Besides the above, no routine maintenance is necessary or beneficial for the vast majority of users; specifically not “cleaning caches,” “zapping the PRAM,” "resetting the SMC," “rebuilding the directory,” "defragmenting the drive," “running periodic scripts,” “dumping logs,” "deleting temp files," “scanning for viruses,” "purging memory," "checking for bad blocks," or “repairing permissions.” Such measures are either completely pointless or are useful only for solving problems, not for prevention.
    The very height of futility is running an expensive third-party application called “Disk Warrior” when nothing is wrong, or even when something is wrong and you have backups, which you must have. Disk Warrior is a data-salvage tool, not a maintenance tool, and you will never need it if your backups are adequate. Don’t waste money on it or anything like it.

  • How to maintain the status of the Thread ?

    How to maintain the status of the Thread ?
    namanc

    I want to know whether a particular thread (java
    application) is completed successfully or not ...
    If the thread is not completed successfully then I
    want to restart the Thread.
    Actually this is the Task Scheduler Application ...
    If the particular task is not running successfully
    then I want to start the Task again ...
    namancThen it could look something like this: // loading the queue
    for each task
        add task to list of incomplete tasks
        enqueue task in work queue
    // dispatcher
    while !done()
        task = workQueue.dequeue();
        New Thread(task).start();When a task finishes, it can call a callback method on the dispatcher. The dispatcher looks at the task's status. If it finished successfully, the task gets removed from the list of incomplete tasks. Else it goes back on the work queue.
    There will be some syncing issues involved. You'll have to use wait() and notify()/notifyAll() to handle the situation where the work queue is empty, and all incomplete tasks are being worked on. And the case where the dispatcher wakes up after the notifyAll() and there's nothing to dequeue and nothing in the list of incomplete tasks.
    Clearly it needs some fine tuning, but I hope you get the idea.

  • How do I reference a cell in a matrix that performs the aggregate?

    Assuming I have a Matrix such as:
    Year
    Customer Name SUM(sales amount)
    ... and the text control the aggregate takes place in (the sum function) is named "matrix1_tb_sum"...
    After the report is executed, there will be a column for each year.  Let's say 2013 and 2014 both return.
    What will be the name of the text control for each year?  If I reference "ReportItems!matrix1_tb_sum.Value" from any scope it returns the value of the "right most" column grouping.  How do I reference other column groupings?
    My goal is to add out-of-grouping columns to the right to show additional data, but I don't want to re-type the formulas.  For example, I would add an out-of-group column to the right and add something like:
    =ReportItems!matrix1_tb_sum[2014].Value - ReportItems!matrix1_tb_sum[2013].Value
    ...to show the difference between the two columns without making a SUM IIF.

    Hi Mini Button,
    Base on your description, you have a matrix in your report which you want to add an aggregation field of the Sales Amount for each year and finally add an column to show the difference between two years. Right?
    In Reporting Service, if we want to compare values of two adjacent columns in a matrix, the best way is using custom code to deal with the logic. I have tested in our local environment. In this scenario, we can compare the current value with previous value.
    The difference value is always along with columns generated. So we suggest put this column inside of group instead of appending them at the end of the matrix. In this column, we can call the function defined in the custom code. Here are steps and screenshots
    for your reference:
    Custom code:
    Put the custom code into report:
    Private queueLength As Integer = 2
    Private queueSum As Double = 0
    Private queueFull As Boolean = False
    Private idChange As String=""
    Dim queue As New System.Collections.Generic.Queue(Of Integer)
    Public Function CumulativeQueue(ByVal currentValue As Integer,id As String) As Object
    Dim removedValue As Double = 0
    If idChange <> id then
    ClearQueue()
    idChange = id
    queueSum = 0
    queueFull = False
    CumulativeQueue(currentValue,id)
    Else
    If queue.Count >= queueLength Then
    removedValue = queue.Dequeue()
    End If
    queueSum += currentValue
    queueSum -= removedValue
    queue.Enqueue(currentValue)
    If queue.Count < queueLength Then
    Return Nothing
    ElseIf queue.Count = queueLength And queueFull = False Then
    queueFull = True
    Return (queueSum-currentValue-currentValue)
    Else
    Return (queueSum-currentValue-currentValue)
    End If
    End If
    End Function
    public function ClearQueue()
    Dim i as Integer
    Dim n as Integer = Queue.Count-1
    for i=n To 0 Step-1
    queue.Dequeue()
    next i
    End function
    Click the report Properties and click the “Code” than add above custom code in it, click ok.
    Create a matrix based on your information. Put expression into corresponding positions:
    Expression in the first row: =IIF(Previous(Fields!Year.Value) is nothing,"",IIF(Previous(Fields!Year.Value) is nothing,1,Previous(Fields!Year.Value))&" - "&Fields!Year.Value)
    Expression in the second row: =Code.CumulativeQueue(Fields!SalesAmount.Value,Fields!CustomerName.Value))
    Expression in the third row: =Code.CumulativeQueue(sum(Fields!SalesAmount.Value),Fields!CustomerName.Value)
    Note : You may need to modify the custom code and expression based on the data type in your dataset.
    Save and preview. It looks like below:
    Below similar threads are for your reference:
    SSRS 2008 R2 - Add moving average to column group
    Difference Between the grouped column
    If you still have any question, please feel free to ask.
    Regards
    Vicky Liu

  • How do I reference a cell in a another spreadsheet?

    I have a result budget in one spreadsheet, and doing a cash flow budget in another spreadsheet.
    How do i reference cells in my result budget from my cash flow spreadsheet? I.e. cell references across two different files.
    I am convertering Excel worksheets, and there i have a lot of these kinds of references.
    Thanks,
    Björn, Gothenburg, Sweden

    ykickamoocow wrote:
    Open YOUR eyes.
    I believe they already stated what they were looking for. So didn't need your highlighted document.
    Yvan's eyes were quite open. He is aware of what the OP asked. He is also aware (as ykickamoocow apparently is not) of what moe-jiller asked. The 'highlighted document' was posted in response to moe-jiller, and directly answered moe-jiller's question.
    I must say that this is another poor bit of work by Apple. Numbers is not as useful in some basic areas as Excel.
    That is very frustrating, as I also need this ability to link between different files.
    If you feel that Numbers is not a suitable tool for what you wish/need to do, then use a tool that is suitable to that job. If you think a feature is needed to make numbers a suitable tool for what you wish/need to do, then use the Provide Numbers Feedback menu item in Numbers Help menu to make a feature request.
    Regards,
    Barry

  • How to create reference table in se11

    hi experts
    how to create reference table in se11.
    regards
    subhasis.

    You must specify a reference table for fields containing quantities (<b>data type QUAN) or currency amounts (data type CURR).</b>
    This reference table must contain a field with the format for the <b>currency key (data type CUKY) or unit of measure (data type UNIT).</b> This field is called the reference field of the output field. The reference field can also reside in the table itself.
    A field is only assigned to the reference field at program runtime. For example, if a field is filled with currency amounts, the corresponding currency is determined from the assigned reference field, that is the value entered in this field at the moment defines the currency
    <b>example :</b>
    table <b>T1
    FIELD1   FIELD2(CURR)      FIELD3 .</b>
    table  <b>T2
    FEILD4   FIELD5(CUKY)   FIELD6  </b>  ...
    Then 
    <b>T1-FIELD2 (CURR) -> T2-FIELD5(CUKY)</b>
    so  ....<b> T2</b>   table is called  <b>Refference table</b>   and   <b>T2-FIELD5</b>  is called   <b>Reffernce Field</b> .
    T1-<b>FIELD2</b>  = <b> 1,50,0000</b>. 
    T2-<b>FIELD5</b>  = <b>INR</b> .
    the  amount  is  always  depend  on the some type of Currency  ,so  that the  Amount  should  always  <b>reffernce to an amount type</b> .
    reward  points if it is usefull ...
    Girish

  • How to Maintain table "OIB_USERPARAM"

    Dear All,
    Can anyone help me to understand, how to maintain the table "OIB_USERPARAM", is there a T Code or SPRO link? There are some entries in these tables which needs correction. Please help.
    Regards,
    Anubhav

    Dear Anubhav,
    if I remember correctly, the entries in table OIB_USERPARAM are automatically created for each user if he/she first uses transaction O4_TIGER, and are subsequently updated if O4_TIGER is lect correctly (e.g. F3) with the current user settings:
    "When you leave the transaction, the system saves various user parameters (for example, the last used variants and the expansion status of the overview tree) so that the transaction looks the same the next time you call it. "
    which can be found in the SAP online documentation:
    http://help.sap.com/saphelp_erp60_sp/helpdata/en/cb/a45738bc8b210de10000009b38f8cf/frameset.htm
    section : Management of tank dips
    In addition, you can maintain a worklist of tanks for each user.
    I hope this helps a bit,
    Kind regards,
    Markus

  • I have an Apple 3GS phone. How can I record a telephone call?

    I have an Apple 3GS phone. How can I record a telephone call?

    Sorry, not natively supported on a non-jailbroken iPhone, & there are no Apps that provide this capability for non-jailbroken iPhones. Apple is a US based company, & doing such is not legal in many parts of the US. That's why such is not supported.

Maybe you are looking for