Forum

Referencing a dll via project explorer- wrong "format"!?

devvvv

#1

hello there,

i’m trying to interface with a hardware- which controls laser projectors- called “Netlase”.
the hardware manufacturer has sent me a dll+documentation, which which i should be able to communicate with the device.

however, as soon as i reference the dll via the project explorer and then save the plugin, it will throw an error (see picture);

what’s possible causes for that? i know that’s a rather general question, but as i haven’t referenced dll’s a lot in my own plugins yet (actually only once), it might be something very general i’m doing wrong…

any hints much appreciated!

thx


#2

… no text …


#3

as i’m havig trouble uploading my screenshot, here’s the error message:

Die Metadatendatei “xyz…/netlase.dll” konnte nicht geöffnet werden - ‘Es wurde versucht, eine Datei mit einem falschen Format zu laden.’


#4

is the .dll a native or managed one?


#5

i tried to find out (any tools/hints for that?), no info from the manufacturer yet.
would this be a valid error code for it being unmanaged?

suppose it is unmanaged, would it be sufficient to use DLLImport function (to bring in every function from the dll i want to use)? as i understood that function is mostly used when doing wrappers for c++ in c#?

thanks a lot!


#6

have a look if the dll has something called a COM Interface. If it has, you can include it properly by using monodevelop or visual studio.


#7

as far as i understand the dll should export a DllRegisterServer if there was a COM interface- correct me if i’m wrong- the list of exported functions show nothing like that however(see attached file)…

Exported Functions List.pdf (178.9 kB)


#8

for everybody else having similar troubles, using

using System.Runtime.InteropServices;

and inside your node class:

System.Runtime.InteropServices.DllImport("yourDLL.dll")]
private static extern int yourDLLExportedFunction();

works fine for me. yourDLL.dll needs to be in the same folder as vvvv.exe, or you specify a path instead.
yourDLLExportedFunction is the function of interest, exported by yourDLL.dll; which should be declared in it’s documentation.

after importing it this way i’ve been able to use the functions right away; copy paste edit the lines for additional functions to import.