Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have two dll
1.hello.dll
2.hellox64.dll

both the dll are same but except in platform.
I want to call the same function from the both dll's according to plateform(x86 & x64)
vb.net code
VB
If (IntPtr.Size = "8") Then
                rc = ABCx64(parameters)
            Else
                rc = ABC(parameters)

And calling code like


VB
Public Declare Function ABC Lib "hello" (ByVal parameters As Integer) As IntPtr

Public Declare Function ABCx64 Lib "hellox64" Alias "ABC" (ByVal parameters As Integer) As IntPtr


The problem is it is work fine in x86 bit but not calling for x64 bit,error is ABCx64 is not find
Posted
Updated 8-Dec-11 3:57am
v2
Comments
Albert Holguin 8-Dec-11 9:31am    
Well, don't know about VB.net, but I'm pretty sure this isn't supported in C++ (having the same export function name in a statically linked dll). What ends up happening is only one function gets mapped by the linker to that location. Not completely sure though, that's why I'm posting as comment and not solution.

If you want two functions with the same name on two dlls, you'd have to link the dll dynamically at run-time (again, not sure how this works on VB.net).
Richard MacCutchan 8-Dec-11 10:03am    
Check the exported name from your 64 bit dll, and also that the dll itself is located in the correct place for the loader.
Sergey Alexandrovich Kryukov 8-Dec-11 11:15am    
Change one of your tags, the one misleading the readers! It cannot be C++, this is C++/CLI.
--SA

1 solution

 
Share this answer
 
Comments
Member 7909353 8-Dec-11 23:49pm    
I have done in .def file


EXPORTS
ABC @12
ABCx64 @13
Richard MacCutchan 9-Dec-11 5:22am    
You cannot export the 64 bit and 32 bit methods from the same dll.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900