<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic calling a c function from fortran in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/calling-a-c-function-from-fortran/m-p/963665#M22378</link>
    <description>I have been attempting to access a c function that is located in a .dll file.  The function is called PSLM_GetKey, and it returns an integer type.  My interface for the c function is below: &lt;BR /&gt; &lt;BR /&gt;INTERFACE &lt;BR /&gt; FUNCTION PSLM_GetKey &lt;BR /&gt;  !DEC$ ATTRIBUTES C :: PSLM_GetKey &lt;BR /&gt;  !DEC$ ATTRIBUTES DLLImport :: PSLM_GetKey &lt;BR /&gt; END FUNCTION PSLM_GetKey &lt;BR /&gt;END INTERFACE &lt;BR /&gt; &lt;BR /&gt;Within my fortran code, I attempt to call the fuction using: &lt;BR /&gt;ikey = PSLM_GetKey() &lt;BR /&gt; &lt;BR /&gt;When compiling, I receive the following error: &lt;BR /&gt;unresolved external symbol _pslm_getkey &lt;BR /&gt; &lt;BR /&gt;Is there anything obvious that I am doing incorrectly?  Is it necessary to have the dll's .lib file added to my project?  What if I only have access to the .dll file itself? &lt;BR /&gt; &lt;BR /&gt;Thanks, Barry</description>
    <pubDate>Sat, 18 Aug 2001 03:04:47 GMT</pubDate>
    <dc:creator>Intel_C_Intel</dc:creator>
    <dc:date>2001-08-18T03:04:47Z</dc:date>
    <item>
      <title>calling a c function from fortran</title>
      <link>https://community.intel.com/t5/Software-Archive/calling-a-c-function-from-fortran/m-p/963665#M22378</link>
      <description>I have been attempting to access a c function that is located in a .dll file.  The function is called PSLM_GetKey, and it returns an integer type.  My interface for the c function is below: &lt;BR /&gt; &lt;BR /&gt;INTERFACE &lt;BR /&gt; FUNCTION PSLM_GetKey &lt;BR /&gt;  !DEC$ ATTRIBUTES C :: PSLM_GetKey &lt;BR /&gt;  !DEC$ ATTRIBUTES DLLImport :: PSLM_GetKey &lt;BR /&gt; END FUNCTION PSLM_GetKey &lt;BR /&gt;END INTERFACE &lt;BR /&gt; &lt;BR /&gt;Within my fortran code, I attempt to call the fuction using: &lt;BR /&gt;ikey = PSLM_GetKey() &lt;BR /&gt; &lt;BR /&gt;When compiling, I receive the following error: &lt;BR /&gt;unresolved external symbol _pslm_getkey &lt;BR /&gt; &lt;BR /&gt;Is there anything obvious that I am doing incorrectly?  Is it necessary to have the dll's .lib file added to my project?  What if I only have access to the .dll file itself? &lt;BR /&gt; &lt;BR /&gt;Thanks, Barry</description>
      <pubDate>Sat, 18 Aug 2001 03:04:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/calling-a-c-function-from-fortran/m-p/963665#M22378</guid>
      <dc:creator>Intel_C_Intel</dc:creator>
      <dc:date>2001-08-18T03:04:47Z</dc:date>
    </item>
    <item>
      <title>Re: calling a c function from fortran</title>
      <link>https://community.intel.com/t5/Software-Archive/calling-a-c-function-from-fortran/m-p/963666#M22379</link>
      <description>Yes, it is necessary to have dll's .lib file inserted to your project. Moreover, you should take care of name mangling, which is different in CVF, C and C++. If adding .lib to your project still doesn't work (linker error), you should examine real mangled name of C function using: &lt;BR /&gt; &lt;BR /&gt;dumpbin /exports xxx.dll &lt;BR /&gt; &lt;BR /&gt;and add an ALIAS directive to INTERFACE block (such as !DEC$ATTRIBUTES ALIAS: '_PSLM_GetKey':: PSLM_GetKey -- case is important). Note that if the C dll was compiled with VC++ and &lt;CODE&gt;extern "C"&lt;/CODE&gt; directive was ommited from .cpp file, you could get as ugly a mangled name as &lt;CODE&gt;?_PSLM_GetKey@YAXXHUZ&lt;/CODE&gt;.  &lt;BR /&gt; &lt;BR /&gt;Jugoslav</description>
      <pubDate>Sun, 19 Aug 2001 05:25:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/calling-a-c-function-from-fortran/m-p/963666#M22379</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2001-08-19T05:25:52Z</dc:date>
    </item>
  </channel>
</rss>

