GCC -m32 flag: /usr/bin/ld: skipping incompatible

后端 未结 1 1293
囚心锁ツ
囚心锁ツ 2020-12-17 18:50

On 64 bit host I am trying to build shared libraries with -m32 option. Is it possible for these libraries to be linked with regular 64 bit libraries?

I

1条回答
  •  囚心锁ツ
    2020-12-17 19:53

    It's not possible to link 32 bit applications against 64 bit libraries and vice versa. The problem is that pointers and types in general can't be passed between them. Normally the workaround is to spawn a child process of the other size and use IPC to communicate with that process.

    Think about it this way: If I have a C trivial function:

    extern void foo(void*); 
    

    If it's in a 64bit library and I try and call it from a 32bit library where does the other half of the pointer come from?

    Conversely if it's in a 32bit library and I call it from a 64bit application what happens to the other half of the pointer which I would have to lose to call it?

    0 讨论(0)
提交回复
热议问题