[Shapelib] I have the dll compiled but know I have to make it works in the emulator.

Mateusz Loskot mateusz at loskot.net
Thu Aug 24 15:33:20 PDT 2006


Daniel de la Cuesta wrote:
> That´s right!!! I have just compiled the shapefile.dll for 
> SmartPhones. You are very nice. Thank you.

You're welcome!

> But now I have another problem, I have added the shapefile.dll to my 
> Compact Framework project (Add Existing Item) but I cannot acces to 
> the .dll when the app is running. I get the following exception when
>  I try to access the shapefile.dll during execution:
> 
> MissingMethodException was unhandled Can't find PInvoke DLL 
> 'shapelib.dll'

Please, confirm this checklist (though, there are more issues possible):

1. Your DLL is indeed compiled for Pocket PC and correct CPU
architecture, but not for desktop

2. You've deployed (tricky, may not work with DLL) or manually uploaded
your shapefile.dll file to the mobile device, into directory where is
your .NET CF application .exe file.

If you want to deploy DLL automatically, follow these steps:
1. Right click on your .NET CF app project in the solution explorer
2. Choose Add/Existing Item
3. Navigate to your shapefile.dll
4. Select this file in the solution explorer.
5. Change "Build Action" to "Content"

Note, that after your DLL is uploaded on the device or emulator,
File Explorer won't show it in directory listings because DLLs are
hidden by default.
So, enable "Show all files" to see it.

If you will experience problems with accessing Shapelib API
from .NET Compact Framework, please refer also to following resources:

.NET Compact Framework FAQ: Interoperability
<https://tempuri.org/netframework/programming/netcf/cffaq/#l2ztcl5c>

An Introduction to P/Invoke and Marshaling on
the Microsoft .NET Compact Framework
<http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfintrointerp.asp>

Marshalling Types During Platform Invoke (P/Invoke) on
the Microsoft .NET Compact Framework
<http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfmarshallingtypes.asp>

Advanced P/Invoke on the Microsoft .NET Compact Framework
<http://www.codeproject.com/netcf/compframe2.asp>

Section "Interoperability":
<http://www.c-sharpcorner.com/UploadFile/amit_agrl/BuildingApplicationswith.NETCompactFramework12022005022332AM/BuildingApplicationswith.NETCompactFramework.aspx?ArticleID=5afc377e-559a-4edc-bcd9-bb56fe32ce2b>

Using dumpbin.exe as an Aid for Declaring P/Invokes
<http://msdn.microsoft.com/library/en-us/dnnetcomp/html/netcfdumpbinpinvoke.asp>


I hope it helps.

Cheers
-- 
Mateusz Loskot
http://mateusz.loskot.net



More information about the Shapelib mailing list