Andre said:
I created with MS Visual Studio a Win32 DLL with export and set in
project Settings "use managed extension" to yes, because I want an
unmanaged cpp-Wrapper Class.
If the C# will use [DllImport] then you do not need to make the DLL managed.
If you make it managed then don't use [DllIimport] instead create a public
class and provide static wrapper methods for the methods in the unmanaged
static library.
Note that [DllImport] can only work if the types are marshalable. That is
the basic primitive .NET types (and string). If the methods in the static
library have more complex parameters (like structs or pointers) then you'll
be better off creating managed wrappers to those structs.
Further I linked my static lib to this
project, created a class K and inside a memeber func K::F which call a
static lib function. So now I comiled it and put it into references of
my C# project. In the object browser I see the class but I don't see
any member fnctions.
Did you make K::F a public method? What are the parameters to this method -
are they primitive types?
- So is something wrong, can I call K::F?
- Can I also call K::F with DLLimport and how?
If you compile the DLL as a managed DLL then you should make the class a
managed class (__gc) and public, and make the methods public. Then call it
directly, you do not need [DllImport]
Richard
--
..NET training, development, consulting and mentoring
my email (e-mail address removed) is encrypted with ROT13 (
www.rot13.org)
sign up for my free .NET newsletter at
http://www.wd-mag.com/newsletters/