TheMaj0r

Hello,

I got a library that is unmanaged and not a member of the COM interface. I tried to add reference to it in VS but it cannot be imported.

The library class is object oriented like the following:

public class movie

{

public movie(string movieName,bool persist){}

public int getDuration();

}

I got these info from the API documentation of the lib.

Now is there anyway to call the method getDuration

I thought about creating a proxy for the class then calling Activator.CreateInstance(),

But i am not sure about how to do so!!

Thanks in advance and regards




Re: Visual C# Language Calling unmanaged objects!!

Peter Ritchie

You can only PInvoke static functions that are exported in a DLL. You'd have to instantiate a C++ object movie before you could call getDuration--something that is not supported by .NET (unless it had a COM wrapper).




Re: Visual C# Language Calling unmanaged objects!!

TheMaj0r

mmm so no way.. thanks for the info

Regards






Re: Visual C# Language Calling unmanaged objects!!

Peter Ritchie

If you want to get outside of C#, you can use C++ interop to wrap native classes with a managed wrapper that could be used from any other .NET language (e.g. C#)




Re: Visual C# Language Calling unmanaged objects!!

TheMaj0r

In fact i am ready for the hard work !! but where can i find the best resource to learn how