Hi Raphael,<br><br>I think that Dllimport definition and re-definition of shapelib api are not necessary,<br>but I don&#39;t know what is the cause...<br><br>So, please refer the attach file (includes shapelib and shapelib-api call sample(copy from shpcreate.c), and both build successfully in my environment).<br>
<br>Regards,<br><br>Sanak.<br><br><div class="gmail_quote">2009/6/22 raphael_mws <span dir="ltr">&lt;<a href="mailto:r.speck@minewolf.com">r.speck@minewolf.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Hi Sanak,<br>
<br>
thanks for the answer. I tried what you told me and rebuilt the shapelib<br>
project with the new C/C++ preprocessor commands, but it didn&#39;t change<br>
anything.<br>
<br>
I think I am doing something wrong when accessing the DLL functions. This is<br>
a short sample code:<br>
<br>
&lt;start&gt;<br>
#define DllImport __declspec( dllimport )<br>
#include &lt;iostream&gt;<br>
#include &quot;stdafx.h&quot;<br>
#include &quot;D:\Visual Studio 2008\Projects\Shapelib-1_2_10-mod\shapefil.h&quot;<br>
using namespace std;<br>
<br>
DllImport SHPHandle SHPAPI_CALL SHPOpen();<br>
<br>
int _tmain(int argc, _TCHAR* argv[])<br>
{<br>
        SHPHandle testhandle;   //this works - the compiler finds shapefil.h<br>
        SHPOpen(&quot;test&quot;,&quot;test&quot;);  //this produces the error<br>
<br>
        return 0;<br>
}<br>
&lt;end&gt;<br>
<br>
This is the compiler output:<br>
<br>
1&gt;Verknüpfen... 1&gt;ShapefileCreator.obj : error LNK2019: Verweis auf nicht<br>
aufgelöstes externes Symbol &quot;_SHPOpen&quot; in Funktion &quot;_wmain&quot;. 1&gt;D:\Visual<br>
Studio<br>
2008\Projects\ShapefileCreator\ShapefileCreator\Debug\ShapefileCreator.exe :<br>
fatal error LNK1120: 1 nicht aufgelöste externe Verweise.<br>
<br>
The same as before.<br>
<br>
I added the path to the DLL/LIB file in the Linker section of the VC<br>
property page of my project and to the general search paths. This should be<br>
sufficient, or not?<br>
<br>
Regards,<br>
Raphael<br>
<div><div></div><div class="h5"><br>
<br>
<br>
Sanak wrote:<br>
&gt;<br>
&gt; Hi Raphael,<br>
&gt;<br>
&gt; It seems that the original Visual C++ shapelib project preprocessor<br>
&gt; definitions are invalid. (generated shapelib.lib and shapelib.dll symbols<br>
&gt; are incompatible)<br>
&gt;<br>
&gt; Please try as follows,<br>
&gt; 1. modify shapelib project C/C++ preprocessor definition from VC property<br>
&gt; page<br>
&gt;    SHPAPI_CALL=__stdcall<br>
&gt;      --&gt; SHAPELIB_DLLEXPORT<br>
&gt; 2. modify each source files(dbfopen.c/shpopen.c/shptree.c) C/C++<br>
&gt; preprocessor definition from VC property page<br>
&gt;   SHAPELIB_EXPORTS;SHPAPI_CALL=__stdcall;$(NoInherit)<br>
&gt;      --&gt; SHAPELIB_DLLEXPORT<br>
&gt; 3. rebuild shapelib project.<br>
&gt; 4. import generated shapelib.lib to your project and build.<br>
&gt;<br>
&gt; Regards,<br>
&gt;<br>
&gt; Sanak.<br>
&gt;<br>
&gt; 2009/6/21 raphael_mws &lt;<a href="mailto:r.speck@minewolf.com">r.speck@minewolf.com</a>&gt;<br>
&gt;<br>
&gt;&gt;<br>
&gt;&gt; Hi folks,<br>
&gt;&gt;<br>
&gt;&gt; I am having a real hard time including the shapelib.dll in my VC++ 2008<br>
&gt;&gt; project. I did the following:<br>
&gt;&gt;<br>
&gt;&gt; - recompile the Visual C++ shapelib project from<br>
&gt;&gt; <a href="http://dl.maptools.org/dl/shapelib/contrib/DotNetArchive.zip" target="_blank">http://dl.maptools.org/dl/shapelib/contrib/DotNetArchive.zip</a>. This worked<br>
&gt;&gt; fine, and I got the output dll and lib files.<br>
&gt;&gt;<br>
&gt;&gt; - include the shapefil.h in my .cpp file successfully<br>
&gt;&gt;<br>
&gt;&gt; - tried various possibilities to get the shapelib.dll in the correct<br>
&gt;&gt; PATH.<br>
&gt;&gt; Actually, it should be found by the compiler, I even tried putting it<br>
&gt;&gt; into<br>
&gt;&gt; C:\WINDOWS\system32 to make sure that&#39;s not the problem.<br>
&gt;&gt;<br>
&gt;&gt; - experimented with various combinations of __declspec( dllimport ) to<br>
&gt;&gt; import the functions from the dll<br>
&gt;&gt;<br>
&gt;&gt; When I try to compile, I always get the following error:<br>
&gt;&gt; &quot;error LNK2019: Verweis auf nicht aufgelöstes externes Symbol &quot;_SHPOpen&quot;<br>
&gt;&gt; in<br>
&gt;&gt; Funktion &quot;_wmain&quot;.&quot;<br>
&gt;&gt; (in English: unreferenced extern symbol &quot;... )<br>
&gt;&gt;<br>
&gt;&gt; Can anybody please give me a hint what I might be doing wrong? Or, even<br>
&gt;&gt; better, send me a sample VC project using shapelib.dll?<br>
&gt;&gt;<br>
&gt;&gt; Thanks and kind regards,<br>
&gt;&gt; Raphael<br>
&gt;&gt; --<br>
&gt;&gt; View this message in context:<br>
&gt;&gt; <a href="http://www.nabble.com/Including-shapelib.dll-in-Visual-C%2B%2B-2008-Express-project-tp24132517p24132517.html" target="_blank">http://www.nabble.com/Including-shapelib.dll-in-Visual-C%2B%2B-2008-Express-project-tp24132517p24132517.html</a><br>

&gt;&gt; Sent from the ShapeLib mailing list archive at Nabble.com.<br>
&gt;&gt;<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Shapelib mailing list<br>
&gt;&gt; <a href="mailto:Shapelib@lists.maptools.org">Shapelib@lists.maptools.org</a><br>
&gt;&gt; <a href="http://lists.maptools.org/mailman/listinfo/shapelib" target="_blank">http://lists.maptools.org/mailman/listinfo/shapelib</a><br>
&gt;&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Shapelib mailing list<br>
&gt; <a href="mailto:Shapelib@lists.maptools.org">Shapelib@lists.maptools.org</a><br>
&gt; <a href="http://lists.maptools.org/mailman/listinfo/shapelib" target="_blank">http://lists.maptools.org/mailman/listinfo/shapelib</a><br>
&gt;<br>
&gt;<br>
<br>
</div></div><font color="#888888">--<br>
View this message in context: <a href="http://www.nabble.com/Including-shapelib.dll-in-Visual-C%2B%2B-2008-Express-project-tp24132517p24136300.html" target="_blank">http://www.nabble.com/Including-shapelib.dll-in-Visual-C%2B%2B-2008-Express-project-tp24132517p24136300.html</a><br>

</font><div><div></div><div class="h5">Sent from the ShapeLib mailing list archive at Nabble.com.<br>
<br>
_______________________________________________<br>
Shapelib mailing list<br>
<a href="mailto:Shapelib@lists.maptools.org">Shapelib@lists.maptools.org</a><br>
<a href="http://lists.maptools.org/mailman/listinfo/shapelib" target="_blank">http://lists.maptools.org/mailman/listinfo/shapelib</a><br>
</div></div></blockquote></div><br>