Thursday, February 15, 2007

Calling an unmanaged DLL from .NET (C#)

Calling an unmanaged DLL from .NET (C sharp)

OK, so this first example is going to
show how to call an unmanaged dll from .NET (C#). There's no better way
to explain how it all fits together than by example, so first off we're
going to create an unmanaged dll in C++. The function we're exporting
from the dll would obviously be of vital importance to your business in
the real world and contain a wealth of logic, but for the sake of
simplicity let's have a void function that takes a basic struct as an
argument and does nothing more than alter the fields within it.


The header file in your project should contain the following definitions:

detail







powered by performancing firefox

No comments: