Use 32bit shared library from 64bit application?

前端 未结 2 496
别那么骄傲
别那么骄傲 2021-01-16 12:48

I have created a simple linux 32bit shared library(.so) for my rendering wrappers but i\'ve hit a wall when i figured that i can only use them through 32bit applications....

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-16 13:21

    You must be consistent. A 64-bit application can only use 64-bit libraries and a 32-bit application can only use 32-bit libraries. Both work; either choice is fine, and it's possible to compile the same code for both systems.

    If you go for 'all 32-bit', use:

    • gcc -m32

    If you go for 'all 64-bit', use:

    • gcc -m64

    Sometimes, I'll tell make that the C compiler is gcc -m32 (or -m64) rather than just gcc to ensure the right value is used everywhere.

提交回复
热议问题