Click here to Skip to main content
15,892,927 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a dll for 32bit and 64bit and now I want that my exe call the dll from according to solution platform,means when x64 is set then the dll of 64bit will call.For this I declare a function GetPlatform().

VB
Public Function GetPlateform() As String

        Dim var1 As String
        If (IntPtr.Size = "8") Then
            var1 = "hellox64"
        Else
            var1 = "hello"
        End If
        Return var1
    End Function


and when the form load
this var1 is assign to var.


VB
Public Declare Function function1 Lib "var" (ByVal Id As Integer) As Integer



But When I debug the code "DllNotFoundException" is ocuured.
NOTE:The dll is in vc++.
Posted
Comments
Richard MacCutchan 7-Nov-11 5:15am    
Where is the code to load the DLL?
vikky08 7-Nov-11 5:31am    
Is last line not suffient?
Richard MacCutchan 7-Nov-11 5:44am    
I don't see anything about loading a DLL, merely what looks like a function definition. Note: I am not a VB expert.

1 solution

Why would you want to do this because it won't work. The dll will run in the same context of its host. This means that if the 32bit version of your application is running on a 64bit machine, it would need th 32bit dll because the process is running in 32bit. You can't just mix different 32 and 64bit assemblies together. There is no need to figure this out yourself and would only make things harder otherwise.

Good luck!
 
Share this answer
 

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