i want to use a c libary for my program in C#.
This libary contains a headerfile with functions in c, to control a camera.
Some of these functions in c, use a pointer called *fg
which points at a typedef called Fg_Struct
and finally this typedef is declared as Typedef struct Fg_Struct_s Fg_Struct
So now, i want to use these functions from the header file in my c# program.
I created a new class and imported these functions from the dll-libary
over the pinvoker-addon.
The pinvoker-addon created a new declaration of these functions
(from unmanaged to managed).
Most of these new declared functions has a variable called
Fg_Struct [] Fg
Visual Studio shows me an error for "Fg_Struct is undefined" in C# programm.
For example, i can use the Fg_getLastErrorDiscripstion function to call the Error discription
in C:
fgrab_struct.h
typedef struct Fg_Struct_s Fg_Struct;
fgrab-prototyp.h
include "struct.h"
const char *const Fg_getLastErrorDescription(Fg_Struct *Fg);
main.cpp
Fg_Struct *fg = NULL;
fg = Fg_Init(DLLNAME, boardNr)
fprintf(stderr, "error in Fg_Init: %s\n", Fg_getLastErrorDescription(NULL));
now i want to use it in c#:
CAM_SISO.cs
[DllImport("fglib5.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr Fg_getLastErrorDescription(Fg_Struct [] Fg);`
I'm really new in C# programming and researched in every topics with pinvoker but I couldn't find a right answer for me, how to declare or define Fg_Struct [] Fg to use the Fg_getLastErrorDiscription function in C#.