implicit declaration of function when compiling kernel module - driver

I am new to working in kernel space, so I hope someone can help me with the issue I am having.
I have seen a lot of questions related to implicit declaration of function for userspace c/c++ programs, but I think the issue I am having may be approached differently in kernel space.
The code I am working on is to test out signaling a user application from the driver, which I have working, but the issue was I could not use the function send_sig_info declared in linux/signal.h until I had declared it in the header of my own driver source. I figured if I had included to correct header to access the function call declared there, it should work.
So without the declaration of send_sig_info in my own header:
error: implicit declaration of function ‘send_sig_info’
And then adding to my header file:
static int send_sig_info(int sig, struct siginfo *info, struct task_struct *p);
would allow my code to compile just fine.
Does anyone have an idea why this is?
Thanks.

Related

applying MSDDetector in colab

I have trouble writing the MSD detector correctly. However, it has no attribute ''create''.
I wrote the following code. But my session crashed for an unknown reason.
msd=cv2.xfeatures2d.MSDDetector()
kps1=msd.detect(I1)
I will appreciate any help.
unfortunately, you've found a bug here.
there should be a ´XXX_create()´ function, but someone forgot to expose it to the python api, by adding a CV_WRAP to the function signature here
(and no, you cannot use the 'ordinary' constructor, it does not produce a valid instance (will segfault, if you call any method on it !!))
please raise an issue here
if you're able to build from src, try to fix it locally, by changing that line to:
CV_WRAP static Ptr<MSDDetector> create(....

clang [bcc32c Warning] redeclaration should not add 'dllexport' attribute

I am creating a DLL and exporting a SimpleMAPI DLL function and one of the functions signature is as following:
extern "C" ULONG __declspec(dllexport) WINAPI MAPISendMail(LHANDLE lhSession, ULONG_PTR ulUIParam, lpMapiMessage lpMessage, FLAGS flFlags, ULONG ulReserved);
I am using C++ Builder, using clang compiler. Compiler issues warning:
[bcc32c Warning]: redeclaration of 'MAPISendMail' should not add 'dllexport' attribute mapi.h(262): previous declaration is here
It compiles and works, but I am bothered by this warning. Can it be avoided?
As #RemyLebeau pointed out, the warnings happened because I included <mapi.h> header.
If MAPI DLL is being created (creating your own DLL that other programs will use or exporting MAPI functions), so if one is implementing MAPI support in their own program, then the required structures and #define are copied from the original mapi.h file into a custom header file which is then included. #define such as FLAGS or MapiMessage struct.
If MAPI is being used (so using calling MAPI functions from other DLL, or other programs) then <mapi.h> is included.
So after creating a custom mapidefs.h file which only contained required structures and #define, the problem is now solved.
There is also this example on StackOverflow as well.

problems using the declaration of char

My codes and the errors that I got
I got this problem with the turbo c++ that every time I'm compiling my codes it just pull some errors which I already tested to online compiler (gdb online compiler).
The first error is "Declaration is not allowed here".
The file is .C, not .CPP, so it is probably compiled as C and not as C++. Variable definitions in the middle of the code are only allowed in C++. Just move the definition to the beginning of the function.
The following warnings are "Function should return a value".
If a function is not defined as void (eg. int) it should have a return statement which returns a value of the type of the function.

OmniThreadLibrary C++ builder Build issues

I'v been trying to get OmniThreadLibrary to run in builder, i've built it with all the c++ required files it builds ok but when i use it in an c++ builder app i get a bunch of error messages that look like the following
[bcc32 Error] DSiWin32.hpp(385): E2040 Declaration terminated incorrectly
one points at this line of code in the generated hpp file
static const System::Int8 CSIDL_ADMINTOOLS = System::Int8(0x30);
has anyone had this working in C++ builder or know the best way to resolve these issues
I'm using c++ builder settle and OmniThreadLibrary version 3.06
The Win32 API (and Delphi, for that matter) already declares CSIDL_ADMINTOOLS, Omni should not be declaring it at all. It should be using Delphi's Shlobj unit instead.
The Win32 API declares CSIDL_ADMINTOOLS using a #define statement:
#define CSIDL_ADMINTOOLS 0x0030
So the declaration in Omni's .hpp is getting modified by the C++ preprocessor to this:
static const System::Int8 0x0030 = System::Int8(0x30);
Thus the "Declaration terminated incorrectly" compiler error.
When Delphi code declares something that already exists in C++, it needs to be declared as either {$EXTERNALSYM} or {$NODECLARE} to avoid duplicate declarations, and then optionally use {$HPPEMIT} to output a relevant #include statement in a generated .hpp file. Delphi's units already do that for its Win32 declarations.
If Omni is not already doing that (and the error would suggest it is not) then it needs to be updated accordingly.

Simple OpenCV problem

Why I try to run the following OpenCV program, it shows the following error :
ERROR:
test_1.exe - Application Error
The application failed to initialize properly (0x80000003).
Click on OK to terminate the application.
CODE:
#include "cv.h"
#include "highgui.h"
int main()
{
IplImage *img = cvLoadImage("C:\\face.bmp");
cvSetImageROI(img, cvRect(100,100, 100, 100));
cvAddS(img, cvScalar(50), img);
cvResetImageROI(img);
cvShowImage("Test", img);
cvWaitKey(0);
return 0;
}
When i press F5(im using vs2008express), the program encounters a break point...i have attached a picture...dont know, whether, it will help or not.
Error Snapshot Link
It is not that, only this program is producing this error, but also any kind of image manipulation funciton containing (OpenCV)program is resulting in this sitution.
Such as : cvSmooth
one last thing, it there any dedicated OpenCV forum or sth like that?
I am an administrator.So, yes, ive the permission.
a version mismatch.
sorry, i didn't get it?Version mismatch with what?
But, i have found the error using dependency walker.
Warning: At least one module has an unresolved import due to a missing export
function in a delay-load dependent module.
and also found that, it is a common problem, and found some info in the FAQ of DW...
Why am I seeing a lot of applications where MPR.DLL shows up in red under
SHLWAPI.DLL because it is missing a function named WNetRestoreConnectionA?
I also get a "Warning: At least one module has an unresolved import due to
a missing export function in a delay-load dependent module" message.
Function name : WNetRestoreConnectionA
But there is no guideline about how to solve it. Though, they say, it is not a problem.
i googled a little and found a suggestion.It says,
Turn off your compilers setting to assume you are programming for Win9x.
(I just lost which setting but it is not that difficult, use a #define...)
But i have no idea, how to do that in Visual Studio 2008 express.
Any suggestion how to solve it...
This usually indicates a problem with a dll; either you don't have permission, or a version is mismatched. Try running as Administrator to see if it is a permissions problem. If that doesn't help, try using the Dependency Walker.

Resources