# Problem with calling dll in vb.net

Page 1 of 1

## 4 Replies - 1791 Views - Last Post: 29 January 2010 - 04:48 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=152443&amp;s=969b1f006de6e39c4185ac0e5cec4bb2&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 Q8y

Reputation: 1
• Posts: 54
• Joined: 06-April 09

# Problem with calling dll in vb.net

Posted 28 January 2010 - 04:28 AM

I have problem in calling DLL file in VB.Net that I had Created it in C++... it give me this error message

"An unhandled exception of type 'System.EntryPointNotFoundException' occurred in test_dll_1.exe
Additional information: Unable to find an entry point named 'add_1' in DLL 't1.dll'."

this is my code in C++ (header file)

```
__declspec(dllexport) double add_1(double a, double b);
__declspec(dllexport) double sub_1(double a, double b);

```

the one in the main
```

return (a+b);
}

double sub_1(double a, double b){
return (a-b);
}

```

this code only for creating dll and I did created it correctly and i had tested it in c++ and it did works.... but in the Vb.net I had no luck with it...

This is the code that I wrote it in the VB.net

```Imports System.Runtime.InteropServices

Public Class Form1

<DllImport("t1.dll")> Public Shared Function add_1(ByVal a1 As Double, ByVal a2 As Double) As Double

End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub
End Class

```

and, I did put the .dll file in the bin folder, but also with no luck...

thank u very much in advance.... I hope u can help me Guys.....

Is This A Good Question/Topic? 0

## Replies To: Problem with calling dll in vb.net

### #2 modi123_1

• Suitor #2

Reputation: 9580
• Posts: 36,315
• Joined: 12-June 08

## Re: Problem with calling dll in vb.net

Posted 28 January 2010 - 09:23 AM

If I remember this right - I believe .NET is bitching there is no class containing your c++ functions. Wrap a class around it and go from there.

### #3 Rickster0

Reputation: 16
• Posts: 236
• Joined: 08-July 08

## Re: Problem with calling dll in vb.net

Posted 28 January 2010 - 09:37 AM

This PDF should give you all the information you need.

it's helped me out allot.

http://edais.mvps.or...s%20in%20VB.pdf

### #4 Q8y

Reputation: 1
• Posts: 54
• Joined: 06-April 09

## Re: Problem with calling dll in vb.net

Posted 28 January 2010 - 10:53 AM

modi123_1: I will do that & I will give u the result.

Rickster0: Thank u very very much for the pdf, I can u use this pdf as a reference. and I will try it with my code now.

Thank u very much Guys for ur help... you helped me alot , I a preciate that

### #5 Rickster0

Reputation: 16
• Posts: 236
• Joined: 08-July 08

## Re: Problem with calling dll in vb.net

Posted 29 January 2010 - 04:48 AM

Not a problem. It should work fine,. if there are any problems let me know