From mboxrd@z Thu Jan 1 00:00:00 1970 From: Edouard Tisserant References: <594f0ba9-8e01-d2d2-a58e-2abcb3b72289@gmail.com> <74da7f07-6df9-5a5f-ff63-b414437749b2@xenomai.org> <1dbe3f00-a866-248c-3799-a0d8efeee4e4@gmail.com> Message-ID: <2e75fd33-8998-4cfb-6fa6-bef20f37f2dc@gmail.com> Date: Fri, 27 Apr 2018 16:43:21 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-Language: en-US Subject: Re: [Xenomai] Crash with longer dlopen/dlcose sequence List-Id: Discussions about the Xenomai project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Philippe Gerum , "Xenomai (xenomai@xenomai.org)" > Now let see if dlopen/dlclose some code using alchemy segfaults or not.= =2E. Well, it didn't work as-is, but I finally got it working ! If I was dlopening anything relying on copperplate after that python code, then it was making an assert :=C2=A0 __register_setup_call: Asserti= on `!main_init_done' failed. The reason is that all xenomai libraries we plan to use have to be loaded _before_ call to xenomai_init, so that their setup call is registered. Hereafter is updated (and simplified) python code : from ctypes import * for name in ["cobalt", "modechk", "copperplate", "alchemy"]: =C2=A0=C2=A0=C2=A0 globals()[name] =3D CDLL("lib"+name+".so", mode=3DRTLD= _GLOBAL) cobalt.xenomai_init(pointer(c_int(0)), pointer((POINTER(c_char)*2)(create_string_buffer("python"), None))) Note : Order of dlopen matters. Argument passed to xenomai_init(&argc,&argv) are here only to prevent de-referencing NULL. After this being executed, you can load and unload many shared object that use alchemy and posix (they should not be linked to boostrap_pic.o) Thanks for your answers. -- Edouard