Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / November 2005

Tip: Looking for answers? Try searching our database.

LoadLibrary with vs2005

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sharon_a - 13 Nov 2005 18:17 GMT
Hi,
I'm using vs2005 Beta 2
Window Mobile 5.0 PocketPC Emulator SDK

I have a C++ dll project that export some functions.
This is a sample function :
  #define AMSYNCDB_API __declspec(dllexport)
  extern "C"
  {
  AMSYNCDB_API HRESULT __stdcall GetVer();
  } // extern "C"

  HRESULT GetVer()
  {
    return 0;
  }

When I use LoadLibrary from a C++ project using this code :
HMODULE hm = LoadLibrary(TEXT("\\SmartDeviceDLL\\SmartDeviceDLL.dll"));

It works fine.

If I use LoadLibrary from csharp using this code :

  [DllImport("CoreDll.dll", EntryPoint = "LoadLibrary", SetLastError=true)]
  private static extern int LoadLibrary(string lpFileName);

  int iHndle  = LoadLibrary("\\SmartDeviceDLL\\SmartDeviceDLL.dll");
  int iLastErr = Marshal.GetLastWin32Error();
           

I get iHndle = 0
and iLastErr  = 126
error description :
"The specified module could not be found. "

I used the same code with evc4 and vs 2003 and it worked fine.

Please,
Can someone help me.
Wei-Dong XU [MSFT] - 14 Nov 2005 06:24 GMT
Hi,

Currently I am finding one support professional for you on this issue. If
any update, we will reply at the first time.

Best Regards,
Wei-Dong XU
Microsoft Product Support Services
This posting is provided "AS IS" with no warranties, and confers no rights.
It is my pleasure to be of assistance.
"Peter Huang" [MSFT] - 15 Nov 2005 08:12 GMT
Hi

I think you may try to use the Full Path to the DLL to see if that works.
Or try to check what is the current directory.

HOW TO: Determine the Executing Application's Path
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncfhowto/h
tml/HOWTOExecutingAppPath.asp

Also for compact framework issue, please post in the newsgroup below. This
newsgroup is mainly for desktop framework dev issue.
microsoft.public.dotnet.framework.compactframework
microsoft.public.pocketpc.developer

BTW: beta produce is not supported, because it may have problems which are
fixed in officially released product.

Best regards,

Peter Huang
Microsoft Online Partner Support

Signature

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.