MAMEWorld >> Programming
View all threads Index   Flat Mode Flat  

Anonymous
Unregistered
Re: .Net Question, How to reference a dll with different names
02/28/07 05:22 PM


better late than never I guess...

here are some clues as to how to do what you want.


public delegate Int32 WSAStartupDelegate( UInt16 wVersionRequired, byte[] lpWSAData );
public static WSAStartupDelegate WSAStartup;

public class Win32
{
[DllImport( "ws2_32.dll" )]
public static extern Int32 WSAStartup( UInt16 wVersionRequired, byte[] lpWSAData );
}

public class WinCE
{
[DllImport( "ws2.dll" )]
public static extern Int32 WSAStartup( UInt16 wVersionRequired, byte[] lpWSAData );
}

then do either:

WSAStartup = WinCE.WSAStartup;

or

WSAStartup = Win32.WSAStartup;

depending on which one you want. Then do WSAStartup() and it will call the relevant code.


or you can just decide whether to call WinCE.WSAStartup() or Win32.WSAStartup() at runtime. I find it better to not polute the code, but it's up to you.


Without the classes, this is how to have the same function in different dll's.

[DllImport("coredll.dll", EntryPoint="PeekMessage", SetLastError=true)]
private static extern bool PeekMessageCE(out MSG lpMsg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax, uint wRemoveMsg);

[DllImport("User32.dll", CharSet=CharSet.Auto, EntryPoint="PeekMessage")]
private static extern bool PeekMessageDT(out MSG msg, IntPtr hWnd, uint messageFilterMin, uint messageFilterMax, uint flags);

You then call either PeekMessageCE or PeekMessageDT.


smf

Edited by smf (02/28/07 05:23 PM)







Entire thread
Subject Posted by Posted on
* .Net Question, How to reference a dll with different names 2600 01/26/07 11:31 PM
. * Re: .Net Question, How to reference a dll with different names alpa  03/06/07 12:24 PM
. * Re: .Net Question, How to reference a dll with different names twistyAdministrator  03/06/07 03:51 PM
. * Re: .Net Question, How to reference a dll with different names Anonymous  01/28/07 11:16 PM
. * Re: .Net Question, How to reference a dll with different names 2600  01/29/07 07:32 PM
. * Re: .Net Question, How to reference a dll with different names Anonymous  02/28/07 05:22 PM
. * Re: .Net Question, How to reference a dll with different names Anonymous  02/03/07 10:08 AM
. * Re: .Net Question, How to reference a dll with different names kkd  02/14/07 07:25 PM
. * Re: .Net Question, How to reference a dll with different names Anonymous  02/14/07 09:42 PM
. * Re: .Net Question, How to reference a dll with different names kkd  02/15/07 12:01 AM
. * Re: .Net Question, How to reference a dll with different names Anonymous  02/16/07 06:28 AM

Extra information Permissions
Moderator:  Pi 
0 registered and 45 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 4880