Click here to Skip to main content
15,895,142 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C++
double __stdcall Dif(int a)
{
    if (a != 1300)
    {
        return value;
    }else
    {
        return 9048034884;
    }
}


This is my function in C++.
I want to call this dll function from VB.net 2010.
Please Help Me to do this.
Posted

C++
Imports System.Runtime.InteropServices
Public Class Form1
    <DllImport("Dlllock.dll",
    CallingConvention:=CallingConvention.StdCall)> _
    Private Shared Function Dif(<MarshalAs(UnmanagedType.I4)> ByVal b As Integer) As Double
    End Function



VB
Dim a As Double
        a = Dif(1300)
        MsgBox(a)
 
Share this answer
 
What you need is called P/Invoke: http://en.wikipedia.org/wiki/Platform_Invocation_Services[^].

You really need to learn how to use it. Please start here: http://msdn.microsoft.com/library/en-us/vcmxspec/html/vcmg_PlatformInvocationServices.asp[^].

This CodeProject article can also be useful: Essential P/Invoke[^].

Good luck,
—SA
 
Share this answer
 
Comments
pasztorpisti 17-Aug-13 7:35am    
A 5.
Sergey Alexandrovich Kryukov 17-Aug-13 11:40am    
Thank you.
—SA

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