{"action":"created","issue":{"url":"https://api.github.com/repos/CoolProp/CoolProp/issues/834","labels_url":"https://api.github.com/repos/CoolProp/CoolProp/issues/834/labels{/name}","comments_url":"https://api.github.com/repos/CoolProp/CoolProp/issues/834/comments","events_url":"https://api.github.com/repos/CoolProp/CoolProp/issues/834/events","html_url":"https://github.com/CoolProp/CoolProp/issues/834","id":110798842,"number":834,"title":"Accessing low-level interface from fortran 90/95","user":{"login":"smyng91","id":14999947,"avatar_url":"https://avatars.githubusercontent.com/u/14999947?v=3","gravatar_id":"","url":"https://api.github.com/users/smyng91","html_url":"https://github.com/smyng91","followers_url":"https://api.github.com/users/smyng91/followers","following_url":"https://api.github.com/users/smyng91/following{/other_user}","gists_url":"https://api.github.com/users/smyng91/gists{/gist_id}","starred_url":"https://api.github.com/users/smyng91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smyng91/subscriptions","organizations_url":"https://api.github.com/users/smyng91/orgs","repos_url":"https://api.github.com/users/smyng91/repos","events_url":"https://api.github.com/users/smyng91/events{/privacy}","received_events_url":"https://api.github.com/users/smyng91/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-10-10T14:57:42Z","updated_at":"2015-10-11T20:34:23Z","closed_at":null,"body":"Hello!\r\n\r\nI've been struggling a lot trying to access low-level interface from Fortran 90/95. I've read the documentation and the example as well, but I still do not get how to link the CoolPropLib.h (header) with Fortran main file. Is there any document I can follow? Based on what I've read so far, it is not a straightforward task to couple Fortran and C++. \r\n\r\nPlease help!\r\n\r\nThanks in advance,\r\nSam"},"comment":{"url":"https://api.github.com/repos/CoolProp/CoolProp/issues/comments/147243278","html_url":"https://github.com/CoolProp/CoolProp/issues/834#issuecomment-147243278","issue_url":"https://api.github.com/repos/CoolProp/CoolProp/issues/834","id":147243278,"user":{"login":"smyng91","id":14999947,"avatar_url":"https://avatars.githubusercontent.com/u/14999947?v=3","gravatar_id":"","url":"https://api.github.com/users/smyng91","html_url":"https://github.com/smyng91","followers_url":"https://api.github.com/users/smyng91/followers","following_url":"https://api.github.com/users/smyng91/following{/other_user}","gists_url":"https://api.github.com/users/smyng91/gists{/gist_id}","starred_url":"https://api.github.com/users/smyng91/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smyng91/subscriptions","organizations_url":"https://api.github.com/users/smyng91/orgs","repos_url":"https://api.github.com/users/smyng91/repos","events_url":"https://api.github.com/users/smyng91/events{/privacy}","received_events_url":"https://api.github.com/users/smyng91/received_events","type":"User","site_admin":false},"created_at":"2015-10-11T20:34:23Z","updated_at":"2015-10-11T20:34:23Z","body":"Thank you ibell. I was able to successfully define the variable type (it was integer(kind=8) in my case, or just integer(c_long). Now I am facing an issue with the following step, after I obtain \"handle\" from AbstractStsate_factory (I've been following the example with Julia and C++):\r\n\r\n \tcall AbstractState_update(handle, input_pair, P, T)\r\n\r\nSince AbstractSTate_update is a void function in C++, I've defined this function as a subroutine in FORTRAN-C++ interface as follows:\r\n\r\n\t\tSUBROUTINE AbstractState_update(inputPointer, inputType, prop1, prop2) BIND(C, NAME='AbstractState_update')\r\n\t\t\tuse iso_c_binding\r\n\t\t\tinteger(C_long) :: inputPointer\r\n\t\t\tinteger(C_long) :: inputType\r\n\t\t\treal(C_DOUBLE), VALUE :: prop1\r\n\t\t\treal(C_DOUBLE), VALUE :: prop2\r\n\t\t\t\r\n\t\tEND SUBROUTINE AbstractState_update\r\n\r\ninputPonter and inputType have been obtained without any problem (I've actually output these values). Nonetheless, I am getting segmentation-invalid memory reference errors. \r\n\r\nPlease help!\r\nThanks again!\r\n\r\nSam\r\n"}}