ISO C Binding with standard C libraries, and Fortran pointer functions

The ISO-C-Binding extension is mostly working in Sun Fortran, so I have been experimenting with auto-generated interfaces to C libraries, which I hope to develop in to a complete SWIG addition. Ideally, many of the standard C libraries should eventually be commonly available.
One of the problem I realized is that many C library entities are made available via macros. For example, even stdin and stdout are macros by default. The same issues came up when C++ tried to standardize access to C libraries, which resulted in an alternative library to access C functions: http://www.cplusplus.com/reference/clibrary/.
One example is the C 'errno', which is defined as a "modifiable l-value", and traditionally was an external int, but resolves to a function in modern multi-threaded environments. Variations in C libraries probably will require C wrapper functions, but entities like errno can be made to work more like C, if Fortran pointer function results can be handled directly like a normal reference. For example, errno could be accessed as follows:
Fortran source:
program test_errno
use ISO_C_Binding
implicit none
interface
function errno() bind(C,name="cerrno")
use ISO_C_Binding, only: C_int
implicit none
integer(C_int), pointer :: errno
end function errno
end interface
write (*,*) 'errno=',errno()
errno() = 10
write (*,*) 'errno=',errno()
end program test_errno
C source:
#include <errno.h>
int *cerrno(void) { return &errno; }
With the current Sun Fortran, this gives errors. I think that F2008 includes improved specifications involving pointer function results, but I have read through the F2008 draft enough to figure out the details. Ideally, a pointer function result should simply be identical to a temporary pointer variable, instead of lot of complicated specifications involving specific cases. For example, a pointer function returning a derived-type pointer should be able to access a member value like this:
lookup_data("name")%value = 10
where lookup_data is a function returning a pointer to a derived type, which has a member named value.
Does anyone know how F2008 is intended to handle function pointers? Is this something where the details are still incomplete? Is it possible that a complete generalization of function-pointer results is not possible?

The ISO-C-Binding extension is mostly working in Sun Fortran, so I have been experimenting with auto-generated interfaces to C libraries, which I hope to develop in to a complete SWIG addition. Ideally, many of the standard C libraries should eventually be commonly available.
One of the problem I realized is that many C library entities are made available via macros. For example, even stdin and stdout are macros by default. The same issues came up when C++ tried to standardize access to C libraries, which resulted in an alternative library to access C functions: http://www.cplusplus.com/reference/clibrary/.
One example is the C 'errno', which is defined as a "modifiable l-value", and traditionally was an external int, but resolves to a function in modern multi-threaded environments. Variations in C libraries probably will require C wrapper functions, but entities like errno can be made to work more like C, if Fortran pointer function results can be handled directly like a normal reference. For example, errno could be accessed as follows:
Fortran source:
program test_errno
use ISO_C_Binding
implicit none
interface
function errno() bind(C,name="cerrno")
use ISO_C_Binding, only: C_int
implicit none
integer(C_int), pointer :: errno
end function errno
end interface
write (*,*) 'errno=',errno()
errno() = 10
write (*,*) 'errno=',errno()
end program test_errno
C source:
#include <errno.h>
int *cerrno(void) { return &errno; }
With the current Sun Fortran, this gives errors. I think that F2008 includes improved specifications involving pointer function results, but I have read through the F2008 draft enough to figure out the details. Ideally, a pointer function result should simply be identical to a temporary pointer variable, instead of lot of complicated specifications involving specific cases. For example, a pointer function returning a derived-type pointer should be able to access a member value like this:
lookup_data("name")%value = 10
where lookup_data is a function returning a pointer to a derived type, which has a member named value.
Does anyone know how F2008 is intended to handle function pointers? Is this something where the details are still incomplete? Is it possible that a complete generalization of function-pointer results is not possible?

Similar Messages

  • My husband and I share a new PC.  We have different music tastes and each have an iphone.  How can we both use our one computer and one itunes program with separate music libraries and separate iphones?

    My husband and I share a new PC.  We have different music tastes and each have an iphone.  How can we both use our one computer and one itunes program with separate music libraries and separate iphones?

    Each device only syncs waht you select.
    Select only what you want for each phone.

  • How I average data with 78,74,73 and 55 points respectively and end up with an array of 78 points for the average?

    Hi
    As the questions states, how do I average data with 78,74,73 and 55 points respectively and obtain an array of 78 points? 
    When I use the plus vi, Labview somehow produces an array of 55 points when I do the average (see attached vi).
    I have been unlucky in trying to get good results.
    Can anyone help?
    Thank you.
    Attachments:
    average4.vi ‏40 KB

    The add function is polymorphic. It accepts arrays as well as numerics, but you need to understand one thing about array operations in LV. Operations performed on arrays of different sizes will always (I think) work based on the smallest array. For example, if you auto index 2 arrays of different sizes into a for loop, the number of times the loop will run will be the size of the small array. The same is true here - when you wire 2 arrays of different sizes to the add function, only the first N elements of the larger array get processed. The rest are dumped. That's why you get 55 elements.
    Attached is a modification of your VI which shows 2 things:
    The bottom part is your algorithm, only cleaned up. Note how much easier it would be to read now. You should always write clean code. Also, note that I have changed the representation on some of the data from DBL to I32. This is because this is the representation the array function work with and your code had the DBLs coerced for no reason.
    The top part is a different algorithm which should do what you want. Note that like Mike said, the arrays with smaller sizes will have 0s appended at the end, so if you want to avoid that, you will have to modify the last part, where the averaging is done and only divide those columns which are long enough.
    To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
    In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).
    Try to take over the world!
    Attachments:
    average4MOD.vi ‏63 KB

  • Securing file download with standard web security and ssl

    Hi,
    I want to put some files for download in my webapp. At the same time, I want to protect these files using standard servlet security and ssl. So I added <security-constraint> in my web.xml and configured tomcat to allow SSL connection. Now I got the files protected as I expected. When I try to access the file directly from browser, tomcat shows me the login page. However, after correct login, I.E. pops up an error saying something like "Internet Explorer cannot download XXX from XXX. The file could not be written to the cache.". The log file showed the following exception:
    javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset by peer: socket write error
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.checkEOF(SSLSocketImpl.java:1154)
         at com.sun.net.ssl.internal.ssl.AppInputStream.available(AppInputStream.java:40)
         at org.apache.tomcat.util.net.TcpConnection.shutdownInput(TcpConnection.java:90)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:752)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)
    Caused by: javax.net.ssl.SSLException: java.net.SocketException: Connection reset by peer: socket write error
         at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:166)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1476)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1443)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(SSLSocketImpl.java:1407)
         at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:64)
         at org.apache.coyote.http11.InternalOutputBuffer.realWriteBytes(InternalOutputBuffer.java:747)
         at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:403)
         at org.apache.coyote.http11.InternalOutputBuffer.endRequest(InternalOutputBuffer.java:400)
         at org.apache.coyote.http11.Http11Processor.action(Http11Processor.java:961)
         at org.apache.coyote.Response.action(Response.java:182)
         at org.apache.coyote.Response.finish(Response.java:304)
         at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:281)
         at org.apache.catalina.connector.Response.finishResponse(Response.java:473)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
         ... 4 more
    Caused by: java.net.SocketException: Connection reset by peer: socket write error
         at java.net.SocketOutputStream.socketWrite0(Native Method)
         at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
         at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
         at com.sun.net.ssl.internal.ssl.OutputRecord.writeBuffer(OutputRecord.java:283)
         at com.sun.net.ssl.internal.ssl.OutputRecord.write(OutputRecord.java:272)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:663)
         at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
         ... 15 more
    I've tried separating concerns, for example protect files but not require SSL, and enable SSL but do not protect files. Both works respectively but not together. I also tried using a download4j's DownloadServlet. Still doesn't work.
    Have any of you encouter the same situation? If so, could you enlight me what I did wrong? It maybe just a simple SSL configuration or something. Thanks in advance!
    Jack

    My environment setup is:
    JDK 1.5.01
    Tomcat 5.5.7
    For downloading files, I just use plain old <a href> method. I simply right-click the link and choose "save target as...".
    Thanks,
    Jack

  • ISO tools and techniques for dealing with bad doc libraries and lists

    The farm was upgraded from MOSS 2007 to SP 2010. There are a small number of sites that contain lists and libraries which are no longer accessible. I would like to delete these, but when I open the site in SP Designer 2010, it does not display any of the
    lists or libraries - good or bad. There is a left column entry called lists and libraries, but when I click on it, it says there are no items to show in this view. There are lists and libraries that work just fine.
    I have full control on the site. I have also tried using sharepoint admin accounts. SPD 2010 brings up the site. If I go into Site Settings > Site Lists and Libraries, the list and library that I want to delete are listed there for customization,
    but selecting either of them results in an error message.
    Is there a way, perhaps via PowerShell, that I could delete the list and library that are giving me problems?

    Hi,
    According to your description, these lists might be corrupted during the upgrade from MOSS 2007 to SharePoint 2010.
    We can use PowerShell to delete these lists:
    #Get the Web
    $web = Get-SPWeb "<SharePoint-site-URL>"
    #Get the corrupted List
    $list = $web.lists["corrupted list name"]
    #Set the AllowDeletion Flag to True
    $list.AllowDeletion = $true
    $list.Update()
    #Delete the list
    $list.Delete()
    Read more:
    http://www.sharepointdiary.com/2013/07/force-delete-corrupted-sharepoint-list-using-powershell.html#ixzz2uIbSTbya
    Another two links about this for your reference:
    http://www.cdhtalkstech.com/2013/07/27/cleaning-up-corrupt-lists-in-sharepoint-2010/
    http://maxteo.wordpress.com/2012/08/25/delete-sharepoint-sitelist-using-powershell/
    Thanks
    Patrick Liang
    TechNet Community Support

  • ITunes Match with 2 iTunes-libraries and one Apple-ID

    Hello.
    I am using iTunes on a Mac, iPhone and iPad.
    I have two iTunes-libraries with one Apple-ID, one local on my MacBookPro an one with my HomeServer.
    The change between the libraries is realised with a program named "Libra".
    Now i have iTunes Match and the sync with the local library was pefect.
    But what happened if i change at home the library when i want using the library with my HomeServer?
    Is it possible or make it problems?
    I hope you can help me.
    Thank you.
    Thomas

    I'm not familar with Libra, but if it gives you a way for iTunes to be associated with another library at launch, meaning it looks and behaves the same way your original iTunes library does, then when you launch and link to that library, initially iTunes Match will be turned off.  You will have to turn it back on (if prompted to "add this computer, just do it, and if asked for your Apple I.D. just do it).
    Once iTunes Match is turned on, it will scan your library and the results will be added to the initial match.  Providing everything in your second library is determined to be eligible (low-bitrate songs won't be, neither will audiobooks, videos, etc.) you will have a merged library available in the cloud

  • I added a new iTunes account. Wanted new library, did it, but now my old library dissappeared and I can't retrieve it on my laptop. How do I find it. Is it possible to have two different accounts with 2 different libraries and go from one to the other?

    I added a second account to my iTunes on my laptop. I wanted to give 2nd acct. its own library. I did by holding down shift key and going to start menu, choosing all programs then iTunes, then iTunes again. It asked me: choose library or create another iTunes library. I chose the later. I renamed it and saved in My Music. It automatically started up iTunes and brought me to the new library, but I cant get back to the old library with all my purchases, etc... What do I do to get the old library back? Computer illiterate, so please be kind. Thanks

    You are going to need to change the email address you use with your old ID. Once you have got access to your old account you will then log into both accounts at the same time on your Mac and transfer your data to a single account. We can do this later, but need you to get access to your old account first.
    My Apple ID

  • Help with iTunes 7 - Libraries and audio books

    Hi,
    New to these forums and just awaiting receipt of my first Ipod Nano. Couple of queries as I'm trying to get iTunes loaded up ready.
    If I buy an audio book from ITunes Store, will it come in same format as a CD version in terms of its track file types/names etc? Reason I ask is that I'm burning my CD version of 'The Da Vinci Code' onto iTunes. By default it's going into 'Music' and there are about 150+ 'tracks'. That will clog up my Music folder a lot.
    I can't get it to go under 'Audio Books' at all which would seem to be a better place for it, or is that not how the Library works? No matter what I do I can't seem to shift the tracks from Music but I can of course put them all under a playlist entitles 'Da Vinci Code'.
    No major problem as, once I've heard it once, I'll delete it anyway but it seems odd that there is an 'Audiobook' library but not one you are able to put books transferred from CD into?.
    I suspect that the books bought from iTunes are put together differently with different file name suffixes that lets iTunes identify them as books and that any book copies to iTunes from CD will show as music. If not, how do I get books under Audiobooks in the Library???
    I did try converting all the files to aac but even that doesn't affect it.
    Am contemplating getting one of these Rough Guide iTunes/Ipod books but figure it may be a bit of a waste for what is probably fairly simple. That said, the iTunes 'Help' is far from exhaustive (or in parts useful).
    Any help appreciated.
    Message was edited by: Empgamer

    See if this link helps.
    http://aldoblog.com/audiobooks/

  • Tracking User Activity with Standard Web Logs and Tools Like WebTrends

    We are running EP 6 SP14 on UNIX and I'm looking to track user activity.  Not just how many people have logged in, but who is accessing what documents in KM.  For example, what documents are the most popular and how much use the system is getting.
    I was hoping that EP 6 (Unix platform) ran off us some standard web engine (like Apache) and we could just turn web logs on, but from the lack of discussion on SDN, I'm not encouraged.
    All I've seen is unofficial link to a Portal Activity Report, which would get us part of the way, but is not full web reporting.
    Portal Activity Report:
    https://www.sdn.sap.com/irj/sdn?id=/library/uuid/0101b690-0201-0010-6584-a02730ad5edd
    Does anyone have any insight on this?

    HI llise
    Did you get any answers? We are in the same quandry as the exisitng tracking reports are not sufficient for our needs as our users are used to using more sophisticated tools like livestat.

  • How to create a folder with standard contained folders and files in SharePoint 2013?

    I've got folders and files on my SharePoint 2013 site that form a template when I add a new folder for a customer. When I create a new folder for a customer, I want those folders and files added automaticly to that new folder. How can I do that?

    How would I go about doing this without Visual Studio? Is that possible? Need to create Folder templates.
    Every "new folder" created should have nested folders already included. 
    Company Name (New Folder 1) 
    Company Documents (1.01)
    Tax Documents (1.02)
    Bank Statements (1.03)
    Extreme novice, please give as much details as possible! I'm trying to implement SP 2013 without all the 2013 software (Visual Studios, SharePoint Designer, etc.)
    Thank you!

  • HT4061 I updated my phone this morning and now it is stuck with an iTunes logo and arrow pointing to it and a pic of the power cord - the phone was plugged in when I started the update...now I can't access my phone at all

    My phone is plugged in and the screen shows the power cord connector and arrow and the iTunes logo.  I have made sure the plug is in and power on. Touching the screen does nothing. I have turned it off and back on I get an apple pic then back to the iTunes logo pic, arrow and plug....

    I installed new update and have had the connect to iTunes all day.  I got home connected to iTunes and it said my phone couldn't be updated it needed restored to factory settings.  I was reluctant to lose everything so I ignored this and clicked update.  After it installed it said to restore again.  Again I ignored it and this time it updated my phone and my phone turned back on with everything there.
    So glad I ignored the previous messages asking me to restore! You could try this if you have iTunes and don't want it restored to factory settings.

  • How do use iCloud with Microsoft word, excel and power point? are they compatible

    i am trying to use i cloud with mircosoft word and excel but i am not sure if its compatible. do i first need to purchase pages?

    The kernel failure panic kind of message points to some other activity;
    as such, it may be there could be a conflict in some applications; as a
    logical failure is indicated by the first part of the message content.
    Whether or not any common kernel panic resolution ideas could work
    in regard to the trigger of this action, is another matter & unresolved.
    Reading and understanding the resulting logs is part of this resolution;
    the following link has information on these kinds of issues in general.
    Technical Note TN2063: Understanding and Debugging Kernel Panics
    http://developer.apple.com/mac/library/technotes/tn2002/tn2063.html
    Resolving Kernel Panics:
    http://www.thexlab.com/faqs/kernelpanics.html
    If there were more, perhaps from another error log in the system, to
    point to other contributing factors in the cause of this action & report,
    some course of correction could be indicated; should that involve a
    reinstall of certain programs (and their update files, as Office has) or
    perhaps removing other seldom used applications if they were proven
    to be part of conflict in the system, with Office triggering its appearance.
    Some troubleshooting of this issue may point to some course of action
    and if the problem is only software-based, then it may involve testing
    or moving, or reinstalling some applications. There is a chance, too,
    that something else may be acting up at a low-level of the system. If
    that were the case, sometimes a re-install of the system on a wiped
    and zeroed drive would be a path to consider to test or resolve this.
    But only after other things have been tried. If you have a full backup
    of the computer's contents on a bootable external drive, that would be
    a means of testing the computer itself.
    Good luck & happy computing!

  • HT1688 My husband did the update on his phone and when it restarted the screen came up with a plug in and arrow pointing to itunes. This has never happened and I'm not sure what it means. It will not come on.

    Im not sure how to get his phone to come back on. Ive never seen an iphone do this. He updated to the latest version and it came up with a plug in on the screen with an arrow pointing to an itunes app looking thing. I'm sorry if this is confusing but I'm not really sure how to explain what it looks like.

    UNABLE TO RESTORE (connect to iTunes with cable logo)
    If you are trying to restore and you device shows an image of a USB cable and connect to iTunes then carefully follow the steps in this article.  You may need to do is several times http://support.apple.com/kb/ht1808

  • I've added to ios6 to my new ipod touch with no problems. I'm trying to now restore the factory settings but the screen is frozen with an itunes sign and lead pointing towards it. The ipod won't even switch off. Can anyone help as it's driving me crazy

    I've added ios6 to my new ipod but tried then to restore the factory settings. It won't extract any settings and the itunes then tells me that the server cannot be reached or is unavailable. I've been trying all day. Now the ipod has a itunes sign and a computer lead pointing towards it on the screen and this is frozen. It won't switch off or do anything else. Any ideas as this is now driving me crazy.

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • How to learn standard tag libraries

    hello sir
    i m new to standard tag libraries and dont know that how to proceed plz help me out that how to proceed and if possible then plz give the the link of some good study material....
    thank you
    gaurav

    Did it ever occur to you that there are (online) shops with those big paper like bricks, which have words in them? They are called books, and if you read them knowledge will lodge itself into your brain if you will let it.
    Don't be cheap, buy a book!

Maybe you are looking for