Can 64 bit library work in a 32 bit application? For example, my application GUI uses 32 bit Qt. And my business core is a 64 bit library. The OS is 64 bit. Can they work to
Yes, but it is a major nuisance.
First, a kernel is different from a library. Typically, a library is made visible in your process’ virtual address space; it shares the address space with your own code. Calling a library routine is simply a subroutine call.
In contrast, to request services from the kernel, your process executes a special instruction to generate a trap. This trap causes the processor to do some special things that include saving your process’ registers and other state in memory (or in special processor registers that you cannot normally access), changing various modes in the processor to make them suitable for the kernel, and changing the program counter to point to instructions for the kernel. Then the kernel is running. At this point, the kernel might be running in 64-bit mode while your process was running in 32-bit mode. However, the kernel is designed to be aware of these differences. When your kernel inspects your process to see what you are requesting, it looks for information and data structures knowing that your process was running in a 32-bit mode. A kernel can support both 32-bit and 64-bit processes, it just treats each type of process differently.
This presumes, of course, that the 64-bit kernel you are using supports 32-bit processes.
Normally, when you call a library, you want it to be the same mode as your code, because a normal library call is just a subroutine call; it does not generate a trap and does not change processor modes. If there were a critical need to call routines in a 64-bit library from a 32-bit process, then you could create a helper 64-bit process. Your 32-bit process would package up a request for a library call and send that request to the 64-bit helper process by some form of interprocess communication. That helper process would call the library routine and send the results back.
Naturally, this adds significant overhead to each library call, so it is something you want to do only if there is a great need and no better alternative.