Message board for the users of flat assembler.
> Main > Creating Classes
Hicel 21 Sep 2007, 14:11
Is it possible to achieve something like classes with fasm I mean defining some variables and procs like
var1 dd ?
var2 dd ?
and load them as new ones to memory everytime you would want it to like
codetocreate new class1
I would like to know how to accomplish this and maybe how c or something does that .. tried to debug compiled code it but didn't get it.
Also technical documents or some site about this would help me.
|21 Sep 2007, 14:11||
realcr 21 Sep 2007, 16:08
First thing I have to note that I'm really against the idea of programming using classes in any assembler. The idea behind assembly language is the simplicity and that everything is low level. However I believe that with fasm macros system it should be very hard to achieve such tasks.
I can tell you that C++ doesn't look that good when implemented in the low level. There are tables of pointers to member functions and such stuff.
About how OOP and classes work in the low level - I suggest you to write some programs in C++ with classes , and try to reverse your own code using ollydbg or IDA. It is a really good way to learn.
You can also read about ObjAsm , which I heard that allows you to write assembly programs according to the OOP ideas.
|21 Sep 2007, 16:08||
r22 22 Sep 2007, 00:39
Passing structures that you allocate using an api like VirtualAlloc to functions is probably the closest you'd want to get to Objects and Classes with ASM.
|22 Sep 2007, 00:39||
Hicel 22 Sep 2007, 17:34
Sorry for the late reply, was a bit busy.
Yes I know but I don't really want to use classes in assembler I know it would be a pain and not very clean. But I'm more interested in how this is achieved by HLL because there must be a good way. I for myself thought like r22 to just have a structure reserve some global memory and everytime a new class is loaded it just does a CopyMemory to this location and the pointers to the functions and variables in memory are calculated and stored. But if it is really done like this in real compilers I find it a bit dirty.. and so I came to the conclusion there must be another way this is why I asked if someone has technical documents on this.
I asked here because I only have Microsoft Visual C++ and tried everything to get a non bloated executable but It seems MSVC++ cannot output just raw bytes its a bit confusing to find what you search between all this "crap"
Anyway thank you for helping me out, I guess I just have to go r22's way it should be the right one!
|22 Sep 2007, 17:34||
< Last Thread | Next Thread >
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.