<?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 Code behaviors in a DLL .... getting a better understanding in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Code-behaviors-in-a-DLL-getting-a-better-understanding/m-p/836501#M55366</link>
    <description>Hello&lt;BR /&gt;&lt;BR /&gt;The DllMain function is designed for simple initialization  or termination tasks. See :&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms682583%28v=VS.85%29.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms682583%28v=VS.85%29.aspx&lt;/A&gt;</description>
    <pubDate>Wed, 18 Aug 2010 12:25:15 GMT</pubDate>
    <dc:creator>GVautier</dc:creator>
    <dc:date>2010-08-18T12:25:15Z</dc:date>
    <item>
      <title>Code behaviors in a DLL .... getting a better understanding</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Code-behaviors-in-a-DLL-getting-a-better-understanding/m-p/836500#M55365</link>
      <description>&lt;P&gt;Greetings:&lt;BR /&gt;&lt;BR /&gt; Playing with DLLs and noticing behaviors that make sense but seeking confirmation.&lt;BR /&gt;&lt;BR /&gt; I amplugging into a 3'rd party application called Unigraphics so I have little control over the execution environment.I am assuming that they load and explicitly unload my DLL each time the user chooses to perform my task.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; 1) "Global" variables defined in the DLL get re-initialized upon each loading of the DLL. So if I want any "static" variable to exist between multiple execution of my dll (with in the same PID)I better write them to an environment variable or file. (my choice is env variable as it is specific to the PID and is cleaned up automatically)&lt;BR /&gt;&lt;BR /&gt; 2) Every DLL at load time gets it's own copy of "atexit" routines. ( reference &lt;A href="http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/2036168e-0f5e-49a7-92d4-24626c80f148)" target="_blank"&gt;http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/2036168e-0f5e-49a7-92d4-24626c80f148)&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt; So how do I load up the "atexit" routines when my dll is loaded? Is there an "atentry" routine that get called when a a dll is loaded?&lt;BR /&gt;&lt;BR /&gt; 3) While global variables get re-initialized, file pointers do not. So let's say the DLL opens a file but does not close it before it is unloaded. Can I assume thefile handles scope is at the process level and not the dll level. So any checks on file closure should be done in the dlls "atexit" routine.&lt;BR /&gt;&lt;BR /&gt; Any comments or pointers to more info would be greatly appreciated.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Carl&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Aug 2010 11:49:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Code-behaviors-in-a-DLL-getting-a-better-understanding/m-p/836500#M55365</guid>
      <dc:creator>carlls</dc:creator>
      <dc:date>2010-08-18T11:49:00Z</dc:date>
    </item>
    <item>
      <title>Code behaviors in a DLL .... getting a better understanding</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Code-behaviors-in-a-DLL-getting-a-better-understanding/m-p/836501#M55366</link>
      <description>Hello&lt;BR /&gt;&lt;BR /&gt;The DllMain function is designed for simple initialization  or termination tasks. See :&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/ms682583%28v=VS.85%29.aspx"&gt;http://msdn.microsoft.com/en-us/library/ms682583%28v=VS.85%29.aspx&lt;/A&gt;</description>
      <pubDate>Wed, 18 Aug 2010 12:25:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Code-behaviors-in-a-DLL-getting-a-better-understanding/m-p/836501#M55366</guid>
      <dc:creator>GVautier</dc:creator>
      <dc:date>2010-08-18T12:25:15Z</dc:date>
    </item>
    <item>
      <title>Code behaviors in a DLL .... getting a better understanding</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Code-behaviors-in-a-DLL-getting-a-better-understanding/m-p/836502#M55367</link>
      <description>Finding out a bit more ..... from &lt;A href="http://msdn.microsoft.com/en-us/library/d1587c1h(v=VS.80).aspx" target="_blank"&gt;http://msdn.microsoft.com/en-us/library/d1587c1h(v=VS.80).aspx&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;LI&gt;&lt;P&gt;An application can have multiple instances of itself running in the system simultaneously, whereas a DLL can have only one instance.&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;An application can own things such as a stack, global memory, file handles, and a message queue, but a DLL cannot.&lt;BR /&gt;&lt;BR /&gt;So a file that is opened in a DLL and not closed by DLL exit is "leaked", and subsequent use of the file will be problematic until the process ends.&lt;/P&gt;&lt;/LI&gt;</description>
      <pubDate>Wed, 18 Aug 2010 13:07:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Code-behaviors-in-a-DLL-getting-a-better-understanding/m-p/836502#M55367</guid>
      <dc:creator>carlls</dc:creator>
      <dc:date>2010-08-18T13:07:30Z</dc:date>
    </item>
  </channel>
</rss>

