<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Integrating a DLL into C#' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Integrating a DLL into C#' posted on the 'C#' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2012 Programmers Heaven</copyright>
    <pubDate>Wed, 23 May 2012 13:24:39 -0700</pubDate>
    <lastBuildDate>Wed, 23 May 2012 13:24:39 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Integrating a DLL into C#</title>
      <link>http://www.programmersheaven.com/mb/csharp/346567/346567/integrating-a-dll-into-c/</link>
      <description>I need a starting point when using a .dll created using C++ within a C# Windows applicatiion.  I'm using Visual Studio .NET 2003 and I copied the dll inside my new project.&lt;br /&gt;
&lt;br /&gt;
I am concerned on how to link the dll to my project and code.  I went to 'add reference' menu and located the dll to add, but I'm not for sure if I should use the NET tab or the COM tab.  Does it matter?  What's the difference?&lt;br /&gt;
&lt;br /&gt;
Once added, the dll does show in the solution explorer under the reference node along with the defualt system/system.data/.window/window.form.  BUT, once I to use the 'using' to declare my namespace along side the defualt 'system.windows.form', I get the error namespace name can not be found.  What is my problem here?&lt;br /&gt;
&lt;br /&gt;
Am I missing something in my process?  How do I use a created dll within a C# project?  How do I reference the functions inside the dll in the C# source code?  If you can help and/or point me in the right driection, it will be greatly appreciated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
-=The Best Has Yet To Come=-&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/csharp/346567/346567/integrating-a-dll-into-c/</guid>
      <pubDate>Tue, 10 Oct 2006 09:45:48 -0700</pubDate>
      <category>C#</category>
    </item>
    <item>
      <title>Re: Integrating a DLL into C#</title>
      <link>http://www.programmersheaven.com/mb/csharp/346567/346692/re-integrating-a-dll-into-c/#346692</link>
      <description>: I need a starting point when using a .dll created using C++ within a C# Windows applicatiion.  I'm using Visual Studio .NET 2003 and I copied the dll inside my new project.&lt;br /&gt;
: &lt;br /&gt;
: I am concerned on how to link the dll to my project and code.  I went to 'add reference' menu and located the dll to add, but I'm not for sure if I should use the NET tab or the COM tab.  Does it matter?  What's the difference?&lt;br /&gt;
: &lt;br /&gt;
: Once added, the dll does show in the solution explorer under the reference node along with the defualt system/system.data/.window/window.form.  BUT, once I to use the 'using' to declare my namespace along side the defualt 'system.windows.form', I get the error namespace name can not be found.  What is my problem here?&lt;br /&gt;
: &lt;br /&gt;
: Am I missing something in my process?  How do I use a created dll within a C# project?  How do I reference the functions inside the dll in the C# source code?  If you can help and/or point me in the right driection, it will be greatly appreciated.&lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: &lt;br /&gt;
: -=The Best Has Yet To Come=-&lt;br /&gt;
: &lt;br /&gt;
&lt;br /&gt;
Hi buddy:&lt;br /&gt;
&lt;br /&gt;
Well, I only once linked a 'C++ made' Dll and I did it for using ports on XP.&lt;br /&gt;
Whithin the code of the main program I used this:&lt;br /&gt;
&lt;br /&gt;
class Port{&lt;br /&gt;
 [DllImport("Inpout32.dll", EntryPoint="Out32")]&lt;br /&gt;
 public static extern void Output(byte bData, word wPort);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Explanation:&lt;br /&gt;
-----------&lt;br /&gt;
I was importing "Inpout32.dll" in order to use the function "Out32" which is inside the dll.&lt;br /&gt;
"public" made this function call public.&lt;br /&gt;
"static" means you don't have to declare an instance of the class Port&lt;br /&gt;
"extern" means you are declaring an extern function (inside the DLL)&lt;br /&gt;
"void"   you already know...&lt;br /&gt;
&lt;br /&gt;
Considering that, the paradigmatic declaration should be:&lt;br /&gt;
&lt;br /&gt;
class NameOfTheClass{&lt;br /&gt;
 [DllImport("YourDLL.dll",EntryPoint="FunctionInsid
eDLL")]&lt;br /&gt;
 public static extern ReturnType AliasName(Type Param[,Type Param [..]])&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
public static Main(){&lt;br /&gt;
 AliasName(...);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
That's all...&lt;br /&gt;
&lt;br /&gt;
Good luck and have fun with C# !!!&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/csharp/346567/346692/re-integrating-a-dll-into-c/#346692</guid>
      <pubDate>Thu, 12 Oct 2006 06:17:07 -0700</pubDate>
      <category>C#</category>
    </item>
  </channel>
</rss>
