{"id":3359,"date":"2012-04-20T13:47:09","date_gmt":"2012-04-20T04:47:09","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/?p=3359"},"modified":"2012-04-20T13:47:58","modified_gmt":"2012-04-20T04:47:58","slug":"fortran%e3%81%ae%e6%a7%8b%e9%80%a0%e4%bd%93%e3%82%92c%e3%81%8b%e3%82%89%e6%89%b1%e3%81%86","status":"publish","type":"post","link":"http:\/\/www.moonmile.net\/blog\/archives\/3359","title":{"rendered":"Fortran\u306eCOMMON\u30d6\u30ed\u30c3\u30af\u3092C++\u304b\u3089\u6271\u3046"},"content":{"rendered":"<p>\u5c11\u3057\u30e1\u30e2\u66f8\u304d\u3068\u3057\u3066\u5782\u308c\u6d41\u3057\u72b6\u614b\u306b\u3059\u308b\u306e\u3067\u3001\u3054\u5bb9\u8d66\u3092\u3002<\/p>\n<p>Fortran\u306e\u5f15\u6570\u306f\u3001C\u8a00\u8a9e\u306e\u30dd\u30a4\u30f3\u30bf\u306b\u5909\u63db\u3059\u308b\u3053\u3068\u3092\u899a\u3048\u3066\u304a\u3051\u3070\u3001\u5f15\u6570\u3067\u6e21\u3059\u3068\u304d\u306f\u7279\u306b\u554f\u984c\u306a\u3057\u3002<br \/>\n\u305f\u3060\u3057\u3001\u3044\u3061\u3044\u3061\u5927\u91cf\u306e\u8a2d\u5b9a\u30c7\u30fc\u30bf\u306a\u3069\u3092\u3001C\u304b\u3089Fortran\u306b\u6e21\u3059\u306e\u306f\u5927\u5909\u306a\u306e\u3067\u3001\u521d\u671f\u5024\u3063\u307d\u304f Fortran \u306e common \u30d6\u30ed\u30c3\u30af\u3092\u4f7f\u3046\u306e\u304c\u3088\u3044\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n! common block\r\nmodule commodule\r\n    implicit none\r\n    integer posx, posy\r\n    common \/compos\/ posx, posy\r\ncontains\r\n    subroutine comsub1()\r\n        print *, &quot;comsub1: &quot;, posx, posy\r\n    end subroutine comsub1\r\nend module commodule\r\n<\/pre>\n<p>\u306e\u3088\u3046\u306b\u3001commodule \u3068\u3044\u3046\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u4e2d\u306b\u3001compos \u3068\u3044\u3046\u540d\u524d\u306e common \u30d6\u30ed\u30c3\u30af\u3092\u4f5c\u3063\u3066\u304a\u304f\u3002compos \u306f\u3001commodule \u30e2\u30b8\u30e5\u30fc\u30eb\u5185\u3067\u5171\u6709\u3067\u304d\u308b\u3057\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u5916\u306b\u51fa\u3057\u3066\u3057\u307e\u3048\u3070\u6240\u8b02\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u3068\u3057\u3066\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u3002\u305f\u3060\u3057\u3001\u5927\u304d\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u306a\u308b\u3068\u5909\u6570\u540d\u304c\u30d0\u30c3\u30c6\u30a3\u30f3\u30b0\u3059\u308b\u306e\u3067\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u5185\u306b\u5165\u308c\u308b\u304b\u306a\u3093\u3089\u306e\u547d\u540d\u898f\u5247\u3092\u4f5c\u3063\u305f\u307b\u3046\u304c\u3088\u304b\u308d\u3046\u3002<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nextern &quot;C&quot; {\r\n\t\/\/ common \u3067\u30c7\u30fc\u30bf\u3092\u5171\u6709\u3059\u308b\r\n\tstruct ccompos {\r\n\t\tint posx;\r\n\t\tint posy;\r\n\t};\r\n\t\/\/ Fortran\u5074\u306e\u30c7\u30fc\u30bf\u3092\u69cb\u9020\u4f53\u3067\u53c2\u7167\u3059\u308b\r\n\t\/\/ \u30d7\u30ec\u30d5\u30a3\u30c3\u30af\u30b9\u306f\u3064\u304b\u306a\u3044\u6a21\u69d8\r\n\textern ccompos COMPOS;\r\n\t\/\/ intel fortran \u3067\u306f\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u540d+_mp_+\u95a2\u6570\u540d\u3067\u30de\u30c3\u30d4\u30f3\u30b0\u3059\u308b\r\n\t\/\/ \u30e2\u30b8\u30e5\u30fc\u30eb\u540d\u3001\u95a2\u6570\u540d\u306f\u5927\u6587\u5b57\r\n\tvoid COMMODULE_mp_COMSUB1( void );\r\n}\r\n<\/pre>\n<p>C++\u304b\u3089\u6271\u3046\u3068\u304d\u306f\u3001common \u30d6\u30ed\u30c3\u30af\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u305d\u306e\u307e\u307e\u69cb\u9020\u4f53\u306b\u3059\u308b\u3002\u3053\u306e\u9806\u756a\u306f fortran \u3067\u5b9a\u7fa9\u3057\u305f\u9806\u756a\u901a\u308a\u306b\u3059\u308b\u3002\u540d\u524d\u306e\u306a\u3044 common \u30d6\u30ed\u30c3\u30af\u306e\u5834\u5408\u306f\u3069\u3046\u3059\u308b\u306e\u304b\u4e0d\u660e\u3002<br \/>\n\u30c7\u30fc\u30bf\u9818\u57df\u306f\u3001fortran \u3067\u4f5c\u6210\u3057\u305f\u30e9\u30a4\u30d6\u30e9\u30ea\u5185\u306b\u3042\u308b\u306e\u3067\u3001C++\u304b\u3089\u306f extern \u3067\u53c2\u7167\u3057\u3066\u304a\u304f\u3002\u3053\u306e\u3068\u304d\u306e\u540d\u524d\u304c\u3001fortran \u3067\u5b9a\u7fa9\u3057\u305f common \u30d6\u30ed\u30c3\u30af\u306e\u540d\u79f0\u306b\u306a\u308b\u3002<br \/>\ncommon \u30d6\u30ed\u30c3\u30af\u3078\u306e\u8aad\u307f\u66f8\u304d\u306f\u3001fortran \u304b\u3089\u3082 c++ \u304b\u3089\u3082\u540c\u69d8\u306b\u884c\u3048\u308b\u3002<\/p>\n<p>\u5b9f\u306f\u3001\u5148\u982d\u306e\u30a2\u30c9\u30ec\u30b9\u3060\u3051\u308f\u304b\u308c\u3070\u5f8c\u306f\u30dd\u30a4\u30f3\u30bf\u3067\u30a2\u30af\u30bb\u30b9\u304c\u53ef\u80fd\u306a\u306e\u3067\u3001\u69cb\u9020\u4f53\u3092\u5b9a\u7fa9\u3057\u306a\u304f\u3066\u3082\u540d\u524d\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u30de\u30af\u30ed\u3092\u4f5c\u308c\u305d\u3046\u3060\u304c\u3001\u3042\u307e\u308a\u30b9\u30de\u30fc\u30c8\u306b\u3044\u304d\u305d\u3046\u306b\u306a\u3044\u306e\u3067\u3084\u3081\u3066\u304a\u304f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5c11\u3057\u30e1\u30e2\u66f8\u304d\u3068\u3057\u3066\u5782\u308c\u6d41\u3057\u72b6\u614b\u306b\u3059\u308b\u306e\u3067\u3001\u3054\u5bb9\u8d66\u3092\u3002 Fortran\u306e\u5f15\u6570\u306f\u3001C\u8a00\u8a9e\u306e\u30dd\u30a4\u30f3\u30bf\u306b\u5909\u63db\u3059\u308b\u3053\u3068\u3092\u899a\u3048\u3066\u304a\u3051\u3070\u3001\u5f15\u6570\u3067\u6e21\u3059\u3068\u304d\u306f\u7279\u306b\u554f\u984c\u306a\u3057\u3002 \u305f\u3060\u3057\u3001\u3044\u3061\u3044\u3061\u5927\u91cf\u306e\u8a2d\u5b9a\u30c7\u30fc\u30bf\u306a\u3069\u3092\u3001C\u304b\u3089Fortran\u306b\u6e21 &hellip; <a href=\"http:\/\/www.moonmile.net\/blog\/archives\/3359\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3,22,43],"tags":[],"class_list":["post-3359","post","type-post","status-publish","format-standard","hentry","category-dev","category-c","category-fortran"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/3359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=3359"}],"version-history":[{"count":2,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/3359\/revisions"}],"predecessor-version":[{"id":3361,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/3359\/revisions\/3361"}],"wp:attachment":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=3359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=3359"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=3359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}