Using another lib with golang
Hi, first of all, thx for your work, this lib is very usefull for our project, and also I took some inspiration and tried to use a similar approach for my other needs. I've used your project as base/example and follow the methods of using JSI on react native to execute some code on golang.
I made it work, however when I try to run an application that uses both my new lib and this one, it causes app crash.
What is weird:
If I run my app JSI install first, then your encrypt function, the app crashes. If I do otherwise (your module JSI installs, then mine), then it all works fine. Also if I use 'useJSI = false' flag for your app, then it also works fine(probably that because it loads your golib before mine). I tried to investigate why it happens, and apparently it seems that only 1 'c-shared' go instance can run at same time on a single process.
Now the question, have you got any ideas how to handle that? Sure I can just merge the libs into single shared lib, but it looks like a meh solution since any other addition library that uses cgo will fail too. Thx in advance!
runtime: g 17: unexpected return pc for runtime.cgocallback called from 0x734454d7b4 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E stack: frame={sp:0x72ac09dfb0, fp:0x72ac09dfe0} stack=[0x72ac09c000,0x72ac09e000) 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09deb0: 0x00000072ac09de65 0x0000004000002680 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09dec0: 0x0000000200000003 0x0000004000002680 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09ded0: 0x00000072ac09dea8 0x0000000000000000 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09dee0: 0x00000072f714a6e8 0x00000072ac09df78 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09def0: 0x00000072f6fb6b5c <runtime.cgocallbackg+0x000000000000001c> 0x00000072f70a73b0 <_cgoexp_5c653701e320_OpenPGPBridgeCall+0x0000000000000000> 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09df00: 0x000000400004afe0 0x0000000000000000 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09df10: 0x000000734454d7b4 0x0000000000000000 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09df20: 0x0000000000000000 0x0000000000000000 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09df30: 0x0000000000000000 0x0000000000000000 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09df40: 0x0000000000000000 0x0000000000000000 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09df50: 0x00000072ac09dfe0 0x0000004000002680 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09df60: 0x000000400003c000 0x00000072f70a73b0 <_cgoexp_5c653701e320_OpenPGPBridgeCall+0x0000000000000000> 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09df70: 0x00000072b0ef6900 0x00000072b0ef6808 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09df80: 0x00000072f6fb4ea0 <runtime.cgocallback+0x00000000000000b0> 0x0000000000000000 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09df90: 0x0000000000000000 0x0000000000000000 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09dfa0: 0x0000000000000000 0x0000000000000000 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09dfb0: <0x000000734454d7b4 0x00000072f70a73b0 <_cgoexp_5c653701e320_OpenPGPBridgeCall+0x0000000000000000> 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09dfc0: 0x00000072b0ef6900 0x0000000000000000 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09dfd0: 0x0000000000000000 0x0000000000000000 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09dfe0: >0x0000000000000000 0x0000000000000000 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E 0x00000072ac09dff0: 0x0000000000000000 0x0000000000000000 2024-02-11 23:42:27.730 4723-0 Go com.fastencoderexample E fatal error: unknown caller pc
Hi @maksimlya sorry for taking too long to respond but it seems both libraries share the same references I had a solution that involves build a custom go version but probably there are some missing replacement to do there