m00nbeam360
m00nbeam360

Reputation: 1377

Use Wrapper Class for C#

This is probably an obvious question, but where do I put the dll for a .NET wrapper class, SoundTouchNet, to use in a C# project? I copied the .dll into Windows/Microsoft.NET/assembly/GAC_MSIL, but when I type in "using SoundTouchNet," the compiler can't find it. Here's the site: http://code.google.com/p/soundtouchnet/

I downloaded the dll's for the C++ SoundTouch library and put the .lib in VC/lib, .h in VC/include, and the .dll in System32. Is that also right?

Thanks!

Edit: Does anyone know also how to connect the SoundTouchNet library with the C++ SoundTouch? As mentioned, I have now successfully added the SoundTouchNet reference to the project. Now what? Do I need to do anything with the SoundTouch library, or is this independent from it? Thanks so much for all of your responses!

Upvotes: 1

Views: 3118

Answers (5)

Ravindra Bagale
Ravindra Bagale

Reputation: 17655

i think you have missed to add reference of that DLL into project. Add reference to your project

Project>  Reference > Add Reference > Browse > Select the DLL

for more information see this link

Upvotes: 5

Ofiris
Ofiris

Reputation: 6151

If you are using Visual Studio:

Check the "How to: Add and Remove References in Visual Studio (C#)" in MSDN:

MSDN - Adding / Removing references

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1500485

It's important to understand the difference between assembly references and using directives. A using directive such as

using SoundTouchNet;

just imports the namespace for use in that source file. It means that if you've got a class called SoundTouchNet.Foo, you can just write Foo elsewhere in the code.

Even though assemblies usually contain types within namespaces which match the assembly name (e.g. Foo.Bar.dll will usually contain types within the Foo.Bar namespace) this is just convention - the two kinds of names are entirely separate.

To make that type available in the first place, you need to add a reference to the assembly which contains it. Assuming you're using Visual Studio, go to Solution Explorer, right-click on the References folder-like icon, and select "Add reference". Personally I normally avoid the GAC, just adding references to either other projects in the same solution or specific files (which I usually put in a lib directory for sanity). You should also look at using NuGet for package management - many open source libraries are now made available as NuGet packages.

Upvotes: 2

Jorge Alvarado
Jorge Alvarado

Reputation: 2674

you need to register your external dll in the Global Assembly cache,

 gacutil.exe /i [Assembly] 

the calls are pretty easy, here is the reference http://msdn.microsoft.com/en-us/library/ex0ss12c(v=vs.80).aspx

Upvotes: 0

Osiris
Osiris

Reputation: 4185

Try adding a reference to the dll file.

using Sound... simply removes the need to write SoundTouchNet.RandomFunction() every time.

Upvotes: 2

Related Questions