Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to load DLL (doAdd.dll).

Status
Not open for further replies.

nphani

Technical User
Feb 10, 2002
104
0
0
US
Hi Friends,

I am trying the Platform Invoke stuff and am facing a problem saying "Unable to load DLL (doAdd.dll)" where doAdd.dll is my registered dll.
To try it, i had:
1) written a function in VB6.0 as:
Function doAdd(ByVal firstNum As Integer, ByVal secondNum As Integer) As Integer
doAdd = firstNum + secondNum
Return
End Function
2) Then I made a "DLL" out of it and called it "doAdd.dll"
3) I registered it using regsvr32.
Now I suppose I can use it in .Net (?)
4)I declared it in my code as:
Declare Auto Function doAdd Lib "doAdd.dll" (ByVal firstNum As Integer, ByVal secondNum As Integer) As Integer
5) and tried running it on Page_Load as:
Dim myNum As Int16 = doAdd(12, 13)
Literal1.Text = &quot;<BR><BR>Addition has given: &quot; & myNum.ToString()
But with no success. It says &quot;Unable to load DLL (doAdd.dll)&quot;

Can somebody help me with it?
Also a good reading article on Platform Invoke using VB.Net would be helpful.

Thanx in advance,
Phani
 
If you want to use the Com object in ASP either you have to say

<object runat=server id=&quot;myObj&quot; class=&quot;project.classname&quot; scope=&quot;Page&quot; >
</object>

change project.classname according to your project name and class name.

use the doAdd function as
myObj.doAdd()
------------------------------------------------------------
or
-----------------------------------------------------------

set myObj = Server.CreateObject(&quot;project.classname&quot;)

use the doAdd function as
myObj.doAdd()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top