HighTechTalks DotNet Forums  

LoadLibrary with vs2005

Dotnet Framework (Interop) microsoft.public.dotnet.framework.interop


Discuss LoadLibrary with vs2005 in the Dotnet Framework (Interop) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Sharon_a
 
Posts: n/a

Default LoadLibrary with vs2005 - 11-13-2005 , 01:17 PM






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.




Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default RE: LoadLibrary with vs2005 - 11-14-2005 , 01:24 AM






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.


Reply With Quote
  #3  
Old   
AT
 
Posts: n/a

Default RE: LoadLibrary with vs2005 - 11-15-2005 , 03:12 AM



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/de...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

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


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.