HowTo create a dynamically linked library (DLL) with C# (C-sharp) and
Visual Studio 2005.
HowTo create a dynamically linked library (DLL) with C# (C-sharp) and
Visual Studio 2005.
1. Creating the DLL:
a) Create a new project -> C# Classlibrary.
b) Create your class adding or modifying
a class-file to the project and entering
something like:
2. Test-bind the DLL
a) Create another project WITHOUT closing or deleting the old project.
(This is done by right-clicking on the Project-Explorer and
choosing Add->New Project)
b) The new project needs to now about the DLL. The terminology is
different from that of C++. Here, we talk about "references" instead
of links. Thus, we have to add the DLL to the reference tree of the
new project in the project-explorer. Rightclick on your
new project->add reference->choose tab:Project and add.
c) To make life easier, use the namespace of your dll. Your
main code could look something like this:
Visual Studio 2005.
HowTo create a dynamically linked library (DLL) with C# (C-sharp) and
Visual Studio 2005.
1. Creating the DLL:
a) Create a new project -> C# Classlibrary.
b) Create your class adding or modifying
a class-file to the project and entering
something like:
2. Test-bind the DLL
a) Create another project WITHOUT closing or deleting the old project.
(This is done by right-clicking on the Project-Explorer and
choosing Add->New Project)
b) The new project needs to now about the DLL. The terminology is
different from that of C++. Here, we talk about "references" instead
of links. Thus, we have to add the DLL to the reference tree of the
new project in the project-explorer. Rightclick on your
new project->add reference->choose tab:Project and add.
c) To make life easier, use the namespace of your dll. Your
main code could look something like this:
No comments:
Post a Comment
Your comment is pending for approval