Using VAMP Plugins with C# - c#

I am wondering how to use VAMP Plugins with C# for Visual Studio 2008? I have downloaded multiple VAMP Plugins already. Currently, I have tested them using Sonic Visualiser and it looks great! However, I am having some problems incorporating it to my C# program.
My problem is that whenever I try to reference the .dll file, it gives me an error, something about 'make sure you are referencing a valid assembly or COM object'. How do I get around this?
Thank you very much!

I think you mean these: http://www.vamp-plugins.org/
As far as I can see, they are written in C++, so you can't add them as reference. You need to use P/Invoke to use those plugins.

Related

Two projects with same dll, Cast issue

Hi fellow programmers,
I'm creating a ControlLibrary for future project's that uses the amazing MaterialDesignXaml library. In this ControlLib I use the MaterialDesignThemes.dll that contains several styled controls, resources and classes.
Now my problem is that I need to use the same dll's in the real application (sae sollution for now). If I want to use the mentioned control library in this project (as project reference) I always get this error:
Dll Error in Application Project
.
I understand the problem the compiler has with this, since It cannot check if two refrences (from seperate projects in the sollution) are the same dll. But how can I fix this?
The strange thing is that the designer complains like in the screenshot, but the application runs just fine...
I'm using TortoiseSVN for Version Management, maybe this has to do something with it?
Any idea's?

Use .dll to store other .dlls or .libs

I am using Visual Studio 2010 and I'm trying to create a .dll. My .dll uses an external library .lib. This Library also contains a collection of other libraries (.lib).
So: My main.lib is a container for the collection of libs - and as a result it is about 300mb big.
Now when I use the lib in my dll, its linking fine and it works correctly on my pc. But when I deploy my compiled program to another computer, then it couldn't load the .lib. It simply can't find it, even when I've put it into the directory of the .dll.
Now my question: Is there a way I can store all functionality of my .lib in a .dll? So that the .dll file will be about 300mb big but I don't need to deploy the .lib anymore?
Update:
Thank you all very much for your answers. To descripe my problem I want to show you this output of my program:
Unhandled Exception: System.Runtime.InteropServices.SEHException: External componennt has thrown an exception.
I've spent many hours of using google to solve this error. I've found out that it's a problem with a missing file (one of my "external components" (.dll)) couldn't find definitions of classes and so on or otherwise a problem with access rights.
I tried my best to fix this and with one try I had success and could use this program. I know that this is because I have put the main.lib into the right folder, so my program could find it. But now I don't know where to put this main.lib. So: my program is broken again and now I want to fix it... I hope this description helps. It's hard to describe it because I don't know exactly what the problem is...
Update 2:
Thanks to your help I solved my problem. At first I misunderstood the principle of how .dll's and .lib's are working. If anyone else has this problem and will be redirected to this post then #D Stanley's answer will help.
Thanks to #David Heffernan I've found out that it's not any missing .lib or something else which is causing this error. It's a problem in my native C++ Code (which is in the .lib). So I fixed this problem (which caused an exception) and now everything is working fine.
Thank you all for your help.
You can not statically link static libraries in other static libraries. What you should be doing instead is statically linking all those individual static libraries in your DLL. Does the linker not warn you about this?
Also, you can't deploy static libraries to another machine, as they can't be linked at run time.
If I understand your situation:
You have several static libraries (.lib)
They are linked together into one big static library (main.lib)
You want to use this library in your dynamic library (.dll)
I'm not certain what's happening locally, but lib files are not "loaded" at run-time - they are linked into either a dynamic library that is loaded at run time (hence the name "dynamic" or into the executable itself. So if your application is working now, then either you're already linking part of it into your dll or it's getting linked into the executable.
So to answer your question, yes, you can link your lib file into your dll - and it will include all of the necessary object code into it. Note that it may not be as big as the source library - that depends on how much of the original code is used by your library.
I also don't see how c# is part of your situation.
From your description it seems that you are linking with *.lib stubs that accompany DLLs for their static loading. You have those DLLs on your computer but not on other computers where you try to use your DLL. So to make everything work, find and copy those DLLs together with your DLL.

Microsoft.Speech Reference Missing C++/cli

I'm having a hard time finding any information on this so maybe someone here can enlighten me. I've coded a module in C++/Cli, everything is good, but for some reason in the reference list(When I right-click on the VS project to add a reference), I can't find Microsoft.Speech in the list.
There is another one that's equivalent, it's called System.Speech, but I absolutely need Microsoft.Speech. Since the module is pure managed code, shouldn't I have access to all the .NET modules? Or maybe there is a pack I can download to extend it?
Thanks.
Update:
I'm referring to these two calls:
using Microsoft.Speech.AudioFormat;
using Microsoft.Speech.Recognition;
Which can be found in the Kinect SDK samples. I need those in C++/CLI because I cannot access the kinect's recognizer if I use the System native version.
Just in case you are not able to find Microsoft.Speech.dll in the .NET tab, you can do the following:
Import Microsoft.Speech.dll from the following location:
C:\Windows\assembly\GAC_MSIL\Microsoft.Speech\11.0.0.0__31bf3856ad364e35\Microsoft.Speech.dll
Here's the solution :
#using "Microsoft.Speech.dll"
using namespace Microsoft::Speech;
using namespace Microsoft::Speech::Recognition;
Everything now works perfectly.

Importing a dll file written in C or C#

I am trying to import a .dll file which is written in C to Microsoft Visual C# Studio 2010?
Any ideas why I keep on getting this error?
Please make sure that the file is accessible and that it is a valid assembly prompt.
You cannot import a reference to a native DLL. Instead you need to use p/invoke to import each function one by one. This can be a rather laborious process if you have a lot of functions so sometimes a C++/CLI wrapper is more convenient.
I suspect you're not using the DllImportAttribute correctly (or at all). See here:
http://msdn.microsoft.com/en-us/library/aa984739(v=vs.71).aspx

ref and library C++/C#

I am working on C# for a few mounths. Mainly I am working on C++.
On C++ using the visual studio if I wanted to add a a static library I could add it using the configuration of the project add the header and lib and path.
When using C#, I think it is something like DLL, all those assemblies are complied on late binding ?
In addition using the visual studio for the C# I can add a reference. Is this the equel thing as I wrote in the beginning of the question ? only for something like DLL ?
If your want use a Win32 DLL in C#, you must write a C# wrapper for it.
C# is managed, and everything you reference as an assembly gets linked at runtime, as with DLL's in C++. The compiler will check at compile time that you are using your assemblies properly, but it wont link them yet. You can use http://research.microsoft.com/en-us/people/mbarnett/ILMerge.aspx to merge assemblies together, as a post-build step.

Categories

Resources