Advanced and basic examples on how to write a DLL

  • Thread starter Thread starter kimiraikkonen
  • Start date Start date
K

kimiraikkonen

Hi,
On the net, there are no much explanatory examples that tells how to
write a DLL using VB.NET. There are a few but completely lack of
teaching ones that isn't useful for me. Also i had some books but none
of them tells how to write a DLL step by step and deeply and i'd like
to know the priciples of class libraries rather than coding in a
regular exe.

So, i'd like to know what and how i should know writing DLL's
functions, properties (what get & set do and their arguments in dll),
interfaces,

The only clue about writing a DLL i had in that thread (Thanks Tom):
http://groups.google.com/group/micr...hl=en&lnk=st&q=class+library#1973fd12aad4b765

But i want to extend and figure out what principles and techniques
must be applied further, any and more code samples are greatly
appreciated.

Thanks
 
Do you have a specific problem ? This is really not that different. Get and
Set as well as writing functions , classes etc... are not DLL specific but a
general language feature.

I would suggest reading at least once the whole language specification...
 
Do you have a specific problem ? This is really not that different. Get and
Set as well as writing functions , classes etc... are not DLL specific buta
general language feature.

I would suggest reading at least once the whole language specification...

--
Patrice

"kimiraikkonen" <[email protected]> a écrit dans le message de (e-mail address removed)...








- Show quoted text -

Not to solve an existing problem. Actually, i'm looking an all-in-one
DLL sample that covers all issues (functions, properties get - set and
more i wish to know) to learn what a DLL's anatomy is all about.
 
Not to solve an existing problem. Actually, i'm looking an all-in-one
DLL sample that covers all issues (functions, properties get - set and
more i wish to know) to learn what a DLL's anatomy is all about.

A dll is nothing more than a compile group of classes. If you can
write a class, the only thing you need to do is change the build
output to a library (dll) instead of an executable (exe).

Thanks,

Seth Rowe [MVP]
 
Not to solve an existing problem. Actually, i'm looking an all-in-one
DLL sample that covers all issues (functions, properties get - set and
more i wish to know) to learn what a DLL's anatomy is all about.

As said earlier functions, properties etc.. have nothing specific to DLLs.
They are part of the general language specification and can be used the same
way in DLLs and EXEs files.

A DLL is just a way to organize your code (for example so that the same
compiled code can be used from multiple EXEs files) but the code is the same
regardless of wether it is compiled in a DLL or an EXE file...

You could check what features are available around :
http://msdn2.microsoft.com/en-us/library/bbykd75d.aspx

And perhaps once you are familiarized with VB read at least once the whole
spec at :
http://www.microsoft.com/downloads/...d0-f775-40bf-a191-09f5a95ef500&displaylang=en
 
As said earlier functions, properties etc.. have nothing specific to DLLs.
They are part of the general language specification and can be used the same
way in DLLs and EXEs files.

A DLL is just a way to organize your code (for example so that the same
compiled code can be used from multiple EXEs files) but the code is the same
regardless of wether it is compiled in a DLL or an EXE file...

You could check what features are available around :http://msdn2.microsoft..com/en-us/library/bbykd75d.aspx

And perhaps once you are familiarized with VB read at least once the whole
spec at :http://www.microsoft.com/downloads/details.aspx?FamilyID=39de1dd0-f77...

Patrice, i knew a DLL's mission / position (bunch of classes, can be
included also in exe and can be called from an exe by referencing and
importing), BUT the thing i wish to see is a real and "all-in-one"
class library CODE sample which is in a educational and summarizing
way. BTW, i've downloaded VB version 8 language specification document
because i only have VB 2005 to test and apply.

Thanks anyway.
 
i wish to see is a real and "all-in-one"
class library CODE sample which is in a educational and summarizing
way

Ok sorry. I doubt you'll find this as generally you study language features
one by one rather than all at once.

The reference part also shows short sample code (btu for each feature
separately). For example
http://msdn2.microsoft.com/en-us/library/sect4ck6.aspx shows a function
sample such as :

Function myFunction(ByVal j As Integer) As Double
Return 3.87 * j
End Function
 
the thing i wish to see is a real and "all-in-one"
class library CODE sample which is in a educational and summarizing
way.

I'm really confused. A dll can be as simple as the following code:

////////////////////
Public Class Foo

End Class
///////////////////

If compiled as a library, it will give you a .NET dll that can be used
by any .NET application. That's as simple as it can get, the process
isn't complicated.

Even though that answers the question you asked, I seriously doubt it
answers the question you meant to ask. If that's the case, then let me
ask you this:

What exactly do you plan on accomplishing with a dll?

If I know what you are looking for and why, it will give me a chance
to give you a good, helpful answer.

Thanks,

Seth Rowe [MVP]
 
I'm really confused. A dll can be as simple as the following code:

////////////////////
Public Class Foo

End Class
///////////////////

If compiled as a library, it will give you a .NET dll that can be used
by any .NET application. That's as simple as it can get, the process
isn't complicated.

Even though that answers the question you asked, I seriously doubt it
answers the question you meant to ask. If that's the case, then let me
ask you this:

What exactly do you plan on accomplishing with a dll?

If I know what you are looking for and why, it will give me a chance
to give you a good, helpful answer.

Thanks,

Seth Rowe [MVP]

Seth,
I was just trying to figure out what a dll consists of all about.
Patrice's statement links on MSDN are quite good. Explains a dll's
architecture good. I usually used to code in interaction with design
mode (like double clicking controls and their events, subroutines,
built-in functions etc.) with just one class named Form1 :-)

That's why i wanted to learn and extend coding class libraries
manually like in a dll. That's why i needed to know all the things
between "Public Class Foo" and "End Class" like in your class. I hope
i explained enough clear.

Thanks
 
I'm really confused. A dll can be as simple as the following code:

////////////////////
Public Class Foo

End Class
///////////////////

If compiled as a library, it will give you a .NET dll that can be used
by any .NET application. That's as simple as it can get, the process
isn't complicated.

Even though that answers the question you asked, I seriously doubt it
answers the question you meant to ask. If that's the case, then let me
ask you this:

What exactly do you plan on accomplishing with a dll?

If I know what you are looking for and why, it will give me a chance
to give you a good, helpful answer.

Thanks,

Seth Rowe [MVP]

For example a good answer to my question:
(Hope to see more)

http://msdn2.microsoft.com/en-us/library/wa0hwf23.aspx
 
For example a good answer to my question:
(Hope to see more)

http://msdn2.microsoft.com/en-us/library/wa0hwf23.aspx

Yeah, that's basically the language spec that Patrice was talking
about. That isn't specific to a dll, but general to everything written
in Visual Basic.NET. As far as the IDE goes, you still should be able
to use the Form designer, I've written a few dlls that expose forms /
usercontrols and I used the ide to lay out the visual components.
Really all a dll is is just a way of deploying code. Dll's can only be
used by other applications, they basically just contain common code
that you want to distribute to be used by other applications.

Thanks,

Seth Rowe [MVP]
 
For a nice, working example, look on PSC for KFTP. It is source for
creating a .dll and a sample program for using it.

It might be a good jumpstart for you. Good luck and buy a book. They
are finally out there for VS2008.

Mike
 
Back
Top