The question really makes no certain sense, because it all depends on the OS and CPU. When you are talking of "library", it probably means that you need to create a software interrupt
. Hardware interrupts are only caused by hardware, your "library" can only handle them.
Now, modern OS are highly protected (and even hardware-protected) and don't give you direct access to interrupts. Some old stuff, like DOS, was broadly based on interrupts. With C++, you could create an interrupt using C++ inline assembler
(see, for example, Inline Assembler
]); and it never required any "libraries".
On 8088/8086 CPU family, it would look like
MOV AH, 0Eh
MOV AL, 'A'
INT 10h ; BIOS interrupt, call to interrupt procedure
On modern systems, the trend is: software interrupts are not used at all, and the hardware interrupts can only be handled in the inner protection ring
, in kernel mode
, which is only designed for inner OS components and kernel-mode drivers
. It's not possible to provide even a short introduction to these topics in a Quick Answer. See also:
Protection ring — Wikipedia, the free encyclopedia
Kernel-Mode Driver Framework — Wikipedia, the free encyclopedia