i'm trying to import an unmanaged dll into a c# application. The dll is given to me but i'm new with dll import thing and having some troubles importing it. Dll comes with a pdf file which describes the functions but all parameters and types are c++ type and i need to write them as c# types. i tried "Dllimport" but i think i couldn't write the correct parameter types. Functions use handles and pointers which doesn't make it easier for me. If someone can write the correct syntax and usage of the functions, i will be most grateful. im writing the functions as described in the pdf:
Comm_Init function: Initializes the DLL for first time loading. Gets a window handle (HWND) as
parameter.
Expand|Select|Wrap|Line Numbers
- void Comm_init
- (
- HWND wndHandle
- );
Expand|Select|Wrap|Line Numbers
- TCommHnd Comm_create
- (
- char *address,
- int port,
- mEventHandler eventHandler,
- int synchComm
- );
Comm_init function initializes DLL, for further usage. It is not a thread safe
function, it should be called one time during the operation of the DLL. All functions except
Comm_init are thread safe functions, for different TCommHnd’s.
I wrote the type definitions and functions into a class file in my project and tried to use the functions in the program. But i think i made some mistakes either in definitions or in usage. I dont really know anything about dllimport and handles but i really need to figure this one out. should i use LoadLibrary and GetProcAddress? Any help will be appreciated,
Best regards