Click here to Skip to main content
14,458,307 members
Rate this:
Please Sign up or sign in to vote.
See more:
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
Rate this:
Please Sign up or sign in to vote.

Solution 2

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



Dim a As Double
        a = Dif(1300)
        MsgBox(a)
   
Rate this:
Please Sign up or sign in to vote.

Solution 1

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
   
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, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100