Skip to main content
10 events
when toggle format what by license comment
Dec 23, 2024 at 4:05 history edited Sᴀᴍ Onᴇᴌᴀ CC BY-SA 4.0
fix typo, formatting
Dec 15, 2023 at 22:08 vote accept my_stack_exchange_account
Dec 14, 2023 at 19:52 comment added my_stack_exchange_account There is no anti-cheat system, it's a speedrunning-related mod for a single player game. I use LD_PRELOAD to load a .so file which uses __attribute__((constructor)) to set things up and write to the game's executable segment when it starts up.
Dec 14, 2023 at 19:29 comment added Ajinkya Kamat this is how you get perma bans. You know that anti-cheat will easily catch you if you try to inject a dll right? They also scan and hash your segments and send them to a server for verification. Also, how is attribute constructor going to help you with changing another program's executable segment?
Dec 14, 2023 at 18:48 comment added my_stack_exchange_account I'm writing to a game's executable segment to mod it for a speedrunning tool. On Linux, I'm doing this using LD_PRELOAD. I also can't just change the game's executable because the moderators said they wouldn't allow that.
Dec 14, 2023 at 18:40 comment added Ajinkya Kamat The C runtime is what calls __attribute__((constructor)) and then main. The C runtime also contains all external linkages to the C standard library. It is true that neither POSIX nor the C standard guarantees that the C runtime will be initialized before __attribute__((constructor)). But that is because none of them recognize the existence of __attribute__((constructor)). It is a compiler-specific attribute. What is your use case though? There might be better ways to implement it instead of doing this
Dec 14, 2023 at 16:33 comment added my_stack_exchange_account Thank you. Also, I read your comment, but I thought you weren't supposed to use standard library functions in __attribute__((constructor)) because the standard library might need things to be initialized too.
Dec 14, 2023 at 11:35 history edited Ajinkya Kamat CC BY-SA 4.0
added 982 characters in body
Dec 14, 2023 at 11:18 history edited Ajinkya Kamat CC BY-SA 4.0
added 982 characters in body
Dec 14, 2023 at 10:37 history answered Ajinkya Kamat CC BY-SA 4.0