<?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 Re: Import std::vector from other DLL in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/import-std-vector-from-other-dll/m-p/5428619#M11720</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know why you want to "export" type "&lt;SPAN&gt;&lt;EM&gt;EXPORT_TEMPLATE_GEOMATH template class _IDMD_GEOMMATH std::vector&amp;lt;Line2D&amp;gt;;&lt;/EM&gt;". You don't need this line. In your Dll, you need to include and use&amp;nbsp;std (for vector) and include Line2D, you correctly exported. Voila.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 01 Dec 2014 09:55:17 GMT</pubDate>
    <dc:creator>maisoui</dc:creator>
    <dc:date>2014-12-01T09:55:17Z</dc:date>
    <item>
      <title>Import std::vector from other DLL</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/import-std-vector-from-other-dll/m-p/5428506#M11719</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a DLL(MFC extension) that has user defined member variables of STL vector of class, for example, std::vector&amp;lt;Line2D&amp;gt;.&lt;/P&gt;&lt;P&gt;It works fine between arx vs arx to export and import.&lt;/P&gt;&lt;P&gt;However, it doesn't work between arx and MFC DLL.&lt;/P&gt;&lt;P&gt;Does anybody know how to export/import?&lt;/P&gt;&lt;P&gt;What I did was that;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//--------------------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;#ifdef GEOMATH_MODULE&lt;BR /&gt;#define &lt;SPAN&gt;_IDMD_GEOMMATH &lt;/SPAN&gt;__declspec(dllexport)&lt;BR /&gt;#define&amp;nbsp;&lt;SPAN&gt;EXPORT_TEMPLATE_GEOMATH&lt;/SPAN&gt;&lt;BR /&gt;#else&lt;BR /&gt;#define &lt;SPAN&gt;_IDMD_GEOMMATH &lt;/SPAN&gt;__declspec(dllimport)&lt;BR /&gt;#define &lt;SPAN&gt;EXPORT_TEMPLATE_GEOMATH&amp;nbsp;&lt;/SPAN&gt;extern&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;class _IDMD_GEOMMATH &amp;nbsp; &amp;nbsp;Line2D&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;};&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EXPORT_TEMPLATE_GEOMATH template class _IDMD_GEOMMATH std::vector&amp;lt;Line2D&amp;gt;;&lt;/P&gt;&lt;P&gt;//--------------------------------------------------------&lt;/P&gt;&lt;P&gt;in the header file to use both module.&lt;/P&gt;&lt;P&gt;Any advice will be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ChangHoon&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Dec 2014 06:57:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/import-std-vector-from-other-dll/m-p/5428506#M11719</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-12-01T06:57:15Z</dc:date>
    </item>
    <item>
      <title>Re: Import std::vector from other DLL</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/import-std-vector-from-other-dll/m-p/5428619#M11720</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know why you want to "export" type "&lt;SPAN&gt;&lt;EM&gt;EXPORT_TEMPLATE_GEOMATH template class _IDMD_GEOMMATH std::vector&amp;lt;Line2D&amp;gt;;&lt;/EM&gt;". You don't need this line. In your Dll, you need to include and use&amp;nbsp;std (for vector) and include Line2D, you correctly exported. Voila.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Dec 2014 09:55:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/import-std-vector-from-other-dll/m-p/5428619#M11720</guid>
      <dc:creator>maisoui</dc:creator>
      <dc:date>2014-12-01T09:55:17Z</dc:date>
    </item>
    <item>
      <title>Re: Import std::vector from other DLL</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/import-std-vector-from-other-dll/m-p/5428719#M11721</link>
      <description>&lt;P&gt;Thank you for your support.&lt;/P&gt;&lt;P&gt;I didn't wite the code "&lt;EM&gt;EXPORT_TEMPLATE_GEOMATH template class _IDMD_GEOMMATH&amp;nbsp;std::vector&amp;lt;Line2D&amp;gt;" &lt;/EM&gt;at the begining.&lt;/P&gt;&lt;P&gt;I made several arx(dll) for my application before(using VS2008). AT that time, no problem to inport/export.&lt;/P&gt;&lt;P&gt;At this time(VS2010) I make them separate DLL(Not arx, MDF DLL)&amp;nbsp;to use in other project.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I made&amp;nbsp;&lt;SPAN&gt;vector&amp;lt;Line2D&amp;gt; in Arx using class Line2D in MFC DLL.&amp;nbsp;If works fine.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;However, &amp;nbsp;if I call a &lt;STRONG&gt;function in MFC&amp;nbsp;DLL&lt;/STRONG&gt; just after&amp;nbsp;making&amp;nbsp;the vector&amp;lt;Line2D&amp;gt; and passing it as&amp;nbsp;a parameter,&amp;nbsp;&lt;SPAN&gt;vector&amp;lt;Line2D&amp;gt; is wrong in a funtion in MFC DLL.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;in Arx.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//-------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;extern __declspec(dllimport) int fun_a(std::vector&amp;lt;Line2D&amp;gt; LineV);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;void ReadLine(int lindex, AcDbEntity *pEnt, std::vector&amp;lt;Line2D&amp;gt;&amp;amp; LineDataV)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;AcDbLine* pLine = AcDbLine::cast(pEnt);&lt;BR /&gt;Point2D StartPt;&lt;BR /&gt;Point2D EndPt;&lt;/P&gt;&lt;P&gt;StartPt.x = pLine-&amp;gt;startPoint().x;&lt;BR /&gt;StartPt.y = pLine-&amp;gt;startPoint().y;&lt;/P&gt;&lt;P&gt;EndPt.x = pLine-&amp;gt;endPoint().x;&lt;BR /&gt;EndPt.y = pLine-&amp;gt;endPoint().y;&lt;/P&gt;&lt;P&gt;Line2D L2(lindex, StartPt, EndPt);&lt;BR /&gt;LineDataV.push_back(L2);&lt;/P&gt;&lt;P&gt;return;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;.....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;vector&amp;lt;Line2D&amp;gt; LineV1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if (pEnt-&amp;gt;isKindOf(AcDbLine::desc()))&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; ReadLine(0, pEnt, LineV1);&lt;BR /&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;int test=func_a(LineV1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//----------------------------------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Funtion in MFC DLL(Not arx).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//-------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;class&amp;nbsp;_IDMD_GEOMMATH Point2D;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;class _IDMD_GEOMMATH Line2D;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;};&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;extern __declspec(dllexport) int fun_a(std::vector&amp;lt;Line2D&amp;gt; LineV2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;int res = 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp;return res;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//-------------------&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;LineV1 is OK. but LineV2 has wrong value.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Of course, if I make Arx instead of MFC DLL,&amp;nbsp;it works fine.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I would appreciate it if you could how to solve it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Dec 2014 12:40:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/import-std-vector-from-other-dll/m-p/5428719#M11721</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2014-12-01T12:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: Import std::vector from other DLL</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/import-std-vector-from-other-dll/m-p/5436823#M11722</link>
      <description>&lt;P&gt;I suspect that the compiler switches or preprocessor defines&amp;nbsp;are different for building the MFC and ARX dlls, causing the STL vectors to be incompatible. Possible areas of mismatch that&amp;nbsp;might cause problems:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Compiler version&lt;/P&gt;
&lt;P&gt;2. debug/release mode&lt;/P&gt;
&lt;P&gt;3. c runtime lib (use dll-based one)&lt;/P&gt;
&lt;P&gt;4. struct&amp;nbsp;alignment (pragma pack macro)&lt;/P&gt;
&lt;P&gt;5. _ITERATOR_DEBUG_LEVEL&amp;nbsp;setting&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As a quick check, maybe you could add a line like: int nSize = sizeof(std::vector&amp;lt;Line2D&amp;gt;); to see if the vector object has different sizes in the two modules. (Note that's not the same thing as their number of elements).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Dec 2014 02:01:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/import-std-vector-from-other-dll/m-p/5436823#M11722</guid>
      <dc:creator>autodaug</dc:creator>
      <dc:date>2014-12-09T02:01:43Z</dc:date>
    </item>
  </channel>
</rss>

