How do you write a DLL

  • Thread starter Thread starter Ken Soenen
  • Start date Start date
K

Ken Soenen

Can anybody tell me the steps involved in making a DLL. Or, better yet point
me to any help info that describes the procedure.
I'm using DOT NET 1.1 standard version.

Thanks
 
Simply create a VS .NET project type of:

Web Service
Web Form
Class Library

depending on what kind of code should be in the dll. When you compile, you
get a .dll.
 
Ken Soenen said:
Can anybody tell me the steps involved in making a DLL. Or, better yet
point me to any help info that describes the procedure.
I'm using DOT NET 1.1 standard version.

Thanks

i recently did this. I created a project and realized that one of the
classes i created could be reused. I created a new project as a class
library. I then referenced the project in my main solution and now the
solution compiles w/ the .exe from one project and the .dll from the other
library. I'm really new to vb and .net and i figured it out, so i know it's
pretty easy.
 
I was able to create a DLL using the method you described. Thankyou for
getting me this far. However, I'm now having a problem with the Entry Point
of the function in the DLL. When the function is called, the entry point
can't be found. Here is my example that I can't get to work. I guess my
problem is that I don't know how to establish a valid EntryPoint.
RUN TIME ERROR received when it comes to line "qq=zzz()":
"Unable to find an entry point named zzz in DLL K:\aadll\mydll"

**** Code in the class Module that compiled to mydll.dll
Public Class Class1
Public Function zzz() As Integer
zzz = 77
End Function
End Class
****
#### code in the forms module to use the above dll function
Public Class Form1
Inherits System.Windows.Forms.Form
Declare Function zzz Lib "K:\aadll\mydll" As Integer
..
..
..
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim qq As Integer
qq = zzz() 'check qq to see if I got 77
End Sub

End Class
####
 
Ken Soenen said:
I was able to create a DLL using the method you described. Thankyou for
getting me this far. However, I'm now having a problem with the Entry
Point
of the function in the DLL.

It does not have a classical entry point. The language that uses your DLL
must support the .NET Framework. There you must set a reference to the DLL
and create an object from Class1 to be able to access the Function. The
plain old-style function container DLLs can not be made in VB.Net.


Armin
 
Armin Zingler said:
It does not have a classical entry point. The language that uses your DLL
must support the .NET Framework.

It must at least support COM :-).
 
Armin,
In my example case, the language used was VB.NET so I would
assume that it supports the .NET Framework. I'm not sure what you mean when
you say "set a reference to the DLL and create an object from Class1". I
went through the links that you provided and couldn't really see anything
that would help. Is there an example somewhere or could you add a few lines
to my failed code to make it work?

I appreciate your time, thankyou.
ken
 
Ken Soenen said:
Armin,
In my example case, the language used was VB.NET so I
would assume that it supports the .NET Framework.

I am talking about the language that *uses* your class. I assumed you are
using the class from a different language because otherwise you would not
have asked how to use it. I was wrong because I was a little bit confused by
the Declare statement, so it was actually not necessary to ask in which
language your Class1 is to be used. Sorry, my mistake.
I'm not sure what you mean when
you say "set a reference to the DLL and create an object from
Class1".

"Set a reference":

Menu Project -> Add reference


"create an object from your Class1":

dim c as RootnamespaceOfYourDLL.class1

c = new RootnamespaceOfYourDLL.class1

I went through the links that you provided and couldn't
really see anything that would help.

I was referring to Herfried's answer mentioning COM interop. I only provided
the links to the documentation. But as you don't need to use COM here, you
can ignore them.


Armin
 
Thanks for your patience Armin. I finally got it to work using your
suggestions.

ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top