I started touching C # the other day.
and I am trying to call a DLL from C #.
There is a function pointer for callback in the argument.
I don't know the case of specifying a callback for this pointer, but
Normally it seems to set -1.
However, I don't know how to set the function pointer to -1.
This is the fifth argument of the sqlite3_bind_text function of winsqlite3.dll.
typedef void (SQLITE_CALLBACK * sqlite3_destructor_type) (void *); #define SQLITE_STATIC ((sqlite3_destructor_type) 0) #define SQLITE_TRANSIENT ((sqlite3_destructor_type) -1) SQLITE_API int SQLITE_APICALL sqlite3_bind_text (sqlite3_stmt *, int, const char *, int, void (SQLITE_CALLBACK *) (void *));
[UnmanagedFunctionPointer (CallingConvention.Cdecl)] public delegate int sqlite3_destructor_type (IntPtr param); [DllImport ("winsqlite3.dll", CallingConvention = CallingConvention.Cdecl)] extern static int sqlite3_bind_text (IntPtr Stmt, int iCol, string Value, int Length, sqlite3_destructor_type cb); const sqlite3_destructor_type SQLITE_TRANSIENT = (sqlite3_destructor_type) (-1); int status = sqlite3_bind_text (Stmt, i, args [i] .ToString (), -1, SQLITE_TRANSIENT);
I don't think I'll be able to escape if I don't write a callback declaration on the declaration side, but make it IntPtr ...
[DllImport ("winsqlite3.dll", CallingConvention = CallingConvention.Cdecl)] extern static int sqlite3_bind_text (IntPtr Stmt, int iCol, string Value, int Length, IntPtr cb); static IntPtr SQLITE_TRANSIENT = (IntPtr) (-1);
Answer # 1
You can declare two methods with the same name but different argument types.
Prepare two types and use them properly.
- c # - i want to run storyboard from viewmodel
- c # - i want to control a text box on another form, but i can't
- i want to read a csv file in c # and output it in json format
- c # - i want to send an object from view to controller
- c # - i want to separate the go string
- i want to know how to display csv data in c # combobox
- c # - unity) i want to use removevalue
- c # - i want to get text information from another file!
- c # - unity ray argument error
- xcode - i want to set a shadow on the stroyboard side
- c # - i want to reflect object data in view
- i want to set the contents of the linux log file to 0
- c # - i want to drag the datagrid on the window
- html - i want to set the home screen icon to an arbitrary one
- c # - i want to draw a thick line with writeablebitmapex
- c # - i want to save the item box
- ruby on rails - i want to set the video as the background
- i want to know the order of writing c # code
- i want to get data like idictionary using linq in c #
- i want to identify the form in c # and pass the value
- c # - how to use dlls in unity
- add update process in c # save button
- how to call a c ++ dynamic library from a c # project in visual studio 2019
- sqlite - can ilmerge also integrate dlls in the created subfolders?
- c # - to include an instance of your own subclass in assetbundle
- c ++ dll with array arguments and settings in c # referencing it