flat assembler
Message board for the users of flat assembler.

Index > Main > Creating Classes

Thread Post new topic Reply to topic

Joined: 09 Sep 2004
Posts: 55
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 ?

proc DoSomething

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.

Post 21 Sep 2007, 14:11
View user's profile Send private message Reply with quote

Joined: 02 Apr 2007
Posts: 39
realcr 21 Sep 2007, 16:08
Hi Hicel.

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.

Post 21 Sep 2007, 16:08
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote

Joined: 27 Dec 2004
Posts: 805
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.
Post 22 Sep 2007, 00:39
View user's profile Send private message AIM Address Yahoo Messenger Reply with quote

Joined: 09 Sep 2004
Posts: 55
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!

Best Regards,
Post 22 Sep 2007, 17:34
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.