skip to Main Content

Ubuntu – Why 'constructor' attributed function with the same name is called 3 times from library X instead of 1 time from libraries X, Y, Z

Scenario: $ cat lib.c #include <stdio.h> #define STR_(x) #x #define STR(x) STR_(x) #define CAT_(x,y) x##y #define CAT(x,y) CAT_(x,y) __attribute__((constructor)) void CAT(foo,)(void) { printf("foo" STR(N) " %pn", CAT(foo,)); } void CAT(bar,N)(void){ puts("bar" STR(N)); } $ cat main.c void barx(void); void bary(void);…

VIEW QUESTION

Ubuntu – Can't compile C HelloWorld

I'm trying to get stated with programmming in C, but when I try to compile "HelloWorld" to run I get a (.text+0x1b): undefined reference to `main'error. Edit: I am using wsl. Ubuntu window: dodojesu@DumbshitsINC:~$ dir hello.c hello.c.save dodojesu@DumbshitsINC:~$ gcc hello.c…

VIEW QUESTION

Json – How to serialize the recursive dictionary in C#?

Below class is the recursive dictionary (tree-like structure). The EntityID is just the alias of string which must be accessed via HierarchicalRelationshipsMap.EntityID. public class HierarchicalRelationshipsMap: Dictionary<HierarchicalRelationshipsMap.EntityID, HierarchicalRelationshipsMap> { public class EntityID { public static implicit operator EntityID(string value) => new…

VIEW QUESTION
Back To Top
Search