Thanks again. This should be pushed to nimble since there's nothing to change
the physical position of fields.
Exactly what I'm looking for! Great job!
I've played a bit with it and tried to add a expected `nnkPostfix` to make it
work with public fields aswell but failed so far. To be honest I never wrote a
macro myself or even looked into the docs about macros.
`0xF0` was just an example, but the padding size could actually be any value.
I'm not sure if I understand `align` correctly and understand how it works but
type Controller* = object
velocity* {.align: 0xF0.}: array[3, float32]
Run
fails with `power of two expected`.
I'm not sure how you exactly would use it in my example as you need to ensure
the power of two and padding fields with alignments would still be required
I know there is the `align` pragma but I guess that won't help me in my case.
I'm looking for a way to automatically add paddings to objects. Like C#
[FieldOffset](https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.fieldoffsetattribute?view=net-5.0)
eg.:
Instead of:
I've faced that issue aswell. Either use a pragma or pass it manually:
{.passL: "-static-libgcc -static-libstdc++".}
Run
I guess I've found a workaround to access the library handle:
import winim/inc/[windef, wincon, winbase]
proc getCurrentModule: HINSTANCE =
discard GetModuleHandleEx(
GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS or
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
Also since I'm currently working with the emitting dllmain, does someone know
if there are risks calling NimMain and then spawn a thread for the maincode?
I could imagine that the gc isn't running anymore or isnt aware of that I
spawned Nimcode with windows' CreateThread
@Recruit_main707 meow is me. However that again will cause timeout issues for
injectors once your code base gets bigger.
@Yardanico I know but thats not I've asked for. The issue is that I need to
pass the first argument (hinstDLL) from dllmain to my main function and AFAIK
nim's default entry point doesn't spawns a thread for the main code. That
causes issues in some cases because a injector for example waits for
That code snippets I've coded are ofcourse compiled with --noMain. However the
"nim" way didn't produces a valid dllmain. The emitting one does but I wan't to
keep my code on nim.
So this got asked [here](https://forum.nim-lang.org/t/3190) already. How to
define a DllMain Entrypoint without emitting raw c code? My example doesn't
works. Looking at the raw cache .c file it also doesn't looks correct at all.
import winim/inc/[windef, wincon]
proc mainT
12 matches
Mail list logo