Ventsislav Velev

I'm using VS2005 and I'm trying to import a bunch of unmanaged classes from a dll. The DllImport attribute, requires you to declare you methods as static extern, however that does not mix well with virtual functions.

I'm getting the following error: "Error 1 A static member CreateSignatureForSinglePackage(out byte[], int, out byte[])' cannot be marked as override, virtual, or abstract"

With pure virtual functions, instead of importing them from the Dll I declared them locally with an empty body, however if I use that same approach with "normal" virtual functions, I'll loose the code in the base version.

Any ideas

Re: Visual C# Language Importing virtual functions from a Dll

Peter Ritchie

You can only import functions that have a DLL entry point. You can't import C++ classes or C++ class members. When you use external functions they must be static which means they cannot be virtual.