Hello Gerhard, Am 05.03.2021 um 19:55 schrieb Gerhard Sittig: > This is a call for testers. Especially on those platforms which > are not exactly mainstream. That is: anything outside of one of > the popular Linux distros, which I used in a local setup.
I ran this in MSYS2 on Windows 10. The make step shows a warning libtool: warning: undefined symbols not allowed in x86_64-w64-mingw32 shared libraries; building static only It looks like the warning is a severe problem, since the app_combo.exe doesn't output anything about the drivers: # ./app_combo.exe communicating ... items: list end I skipped the step with --disable-driver as it doesn't make much sense if the inital step failed. > alternative approach to compile time and linker sections: > register from constructors at runtime, executes before main() > and may not rely on malloc(3), could rely on static vars and > .bss containing zeroes, can use a linked list instead of an > array _if_ driver items provide the node storage, that would > elimintate the need for an upper limit of the number of drivers, > could eliminate the linker section, may be most portable, at > the expense of a little startup code and a little static > non-const memory per registered driver Because there is a problem with inital approach I wanted to know if the mingw compiler in the MSYS2 environment is working with __attribute__((constructor)). I created this makefile and could successfully build and run the application. DRVS:=driver_1.o driver_2.o driver_3.o driver_4.o driver_5.o OBJS=app_main.o comm.o drivers.o $(DRVS) app.exe: $(OBJS) gcc -g -o app.exe $(OBJS) clean: -rm $(OBJS) app.exe Helge@Walrus MINGW64 ~/Projects/constructor_exp # make "DRVS=driver_1.o driver_3.o" clean app.exe rm app_main.o comm.o drivers.o driver_1.o driver_3.o app.exe cc -c -o app_main.o app_main.c cc -c -o comm.o comm.c cc -c -o drivers.o drivers.c cc -c -o driver_1.o driver_1.c cc -c -o driver_3.o driver_3.c gcc -g -o app.exe app_main.o comm.o drivers.o driver_1.o driver_3.o Helge@Walrus MINGW64 ~/Projects/constructor_exp # ./app communicating ... items: 00000000004090a0 3 driver3 0000000000401854 0000000000409060 1 driver1 00000000004017c4 list end driver3, do something driver1, do something So, at least the alternative works. Best regards, Helge
make all-am make[1]: Verzeichnis „/home/Helge/Projects/autotool-experiments/build“ wird betreten depbase=`echo src/app_main.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\ gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/app_main.o -MD -MP -MF $depbase.Tpo -c -o src/app_main.o ../src/app_main.c &&\ mv -f $depbase.Tpo $depbase.Po depbase=`echo src/comm.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/comm.lo -MD -MP -MF $depbase.Tpo -c -o src/comm.lo ../src/comm.c &&\ mv -f $depbase.Tpo $depbase.Plo libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/comm.lo -MD -MP -MF src/.deps/comm.Tpo -c ../src/comm.c -DDLL_EXPORT -DPIC -o src/.libs/comm.o libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/comm.lo -MD -MP -MF src/.deps/comm.Tpo -c ../src/comm.c -o src/comm.o >/dev/null 2>&1 depbase=`echo src/drivers.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/drivers.lo -MD -MP -MF $depbase.Tpo -c -o src/drivers.lo ../src/drivers.c &&\ mv -f $depbase.Tpo $depbase.Plo libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/drivers.lo -MD -MP -MF src/.deps/drivers.Tpo -c ../src/drivers.c -DDLL_EXPORT -DPIC -o src/.libs/drivers.o libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/drivers.lo -MD -MP -MF src/.deps/drivers.Tpo -c ../src/drivers.c -o src/drivers.o >/dev/null 2>&1 depbase=`echo src/driver_1.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/driver_1.lo -MD -MP -MF $depbase.Tpo -c -o src/driver_1.lo ../src/driver_1.c &&\ mv -f $depbase.Tpo $depbase.Plo libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/driver_1.lo -MD -MP -MF src/.deps/driver_1.Tpo -c ../src/driver_1.c -DDLL_EXPORT -DPIC -o src/.libs/driver_1.o libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/driver_1.lo -MD -MP -MF src/.deps/driver_1.Tpo -c ../src/driver_1.c -o src/driver_1.o >/dev/null 2>&1 depbase=`echo src/driver_3.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/driver_3.lo -MD -MP -MF $depbase.Tpo -c -o src/driver_3.lo ../src/driver_3.c &&\ mv -f $depbase.Tpo $depbase.Plo libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/driver_3.lo -MD -MP -MF src/.deps/driver_3.Tpo -c ../src/driver_3.c -DDLL_EXPORT -DPIC -o src/.libs/driver_3.o libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/driver_3.lo -MD -MP -MF src/.deps/driver_3.Tpo -c ../src/driver_3.c -o src/driver_3.o >/dev/null 2>&1 depbase=`echo src/driver_4.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/driver_4.lo -MD -MP -MF $depbase.Tpo -c -o src/driver_4.lo ../src/driver_4.c &&\ mv -f $depbase.Tpo $depbase.Plo libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/driver_4.lo -MD -MP -MF src/.deps/driver_4.Tpo -c ../src/driver_4.c -DDLL_EXPORT -DPIC -o src/.libs/driver_4.o libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/driver_4.lo -MD -MP -MF src/.deps/driver_4.Tpo -c ../src/driver_4.c -o src/driver_4.o >/dev/null 2>&1 depbase=`echo src/driver_5.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /bin/sh ./libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/driver_5.lo -MD -MP -MF $depbase.Tpo -c -o src/driver_5.lo ../src/driver_5.c &&\ mv -f $depbase.Tpo $depbase.Plo libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/driver_5.lo -MD -MP -MF src/.deps/driver_5.Tpo -c ../src/driver_5.c -DDLL_EXPORT -DPIC -o src/.libs/driver_5.o libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -g -O2 -MT src/driver_5.lo -MD -MP -MF src/.deps/driver_5.Tpo -c ../src/driver_5.c -o src/driver_5.o >/dev/null 2>&1 /bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -version-info 1:2:0 -o src/libcombo.la -rpath /mingw64/lib src/comm.lo src/drivers.lo src/driver_1.lo src/driver_3.lo src/driver_4.lo src/driver_5.lo libtool: warning: undefined symbols not allowed in x86_64-w64-mingw32 shared libraries; building static only libtool: link: ar cru src/.libs/libcombo.a src/comm.o src/drivers.o src/driver_1.o src/driver_3.o src/driver_4.o src/driver_5.o libtool: link: ranlib src/.libs/libcombo.a libtool: link: ( cd "src/.libs" && rm -f "libcombo.la" && cp -pR "../libcombo.la" "libcombo.la" ) /bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -o app_combo.exe src/app_main.o src/libcombo.la libtool: link: gcc -g -O2 -o .libs/app_combo.exe src/app_main.o src/.libs/libcombo.a make[1]: Verzeichnis „/home/Helge/Projects/autotool-experiments/build“ wird verlassen
_______________________________________________ sigrok-devel mailing list sigrok-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sigrok-devel