Hi All,
What would be involved with using existing C++ lib's with assembler?
Say you want to use a lib such as Qt or wxWidgets for a gui, you have to derive you own window object from one in their lib, how would you go about this in asm??
I'm still learning asm and I'd really like to use it for my development (particularly HLA) but I'd like to stay OS independant, I have no problem with the win32 api but I think I need a bit more functionality than what X Windows offers for linux or is it basically the same as win32??
thanks,
Mick.
What would be involved with using existing C++ lib's with assembler?
Say you want to use a lib such as Qt or wxWidgets for a gui, you have to derive you own window object from one in their lib, how would you go about this in asm??
I'm still learning asm and I'd really like to use it for my development (particularly HLA) but I'd like to stay OS independant, I have no problem with the win32 api but I think I need a bit more functionality than what X Windows offers for linux or is it basically the same as win32??
thanks,
Mick.
Using a C lib from assembly is easy.
Using C++ can get nasty because of name decoration, and -IMHO- isn't really worth it - better to use C++ with assembly, then.
Using C++ can get nasty because of name decoration, and -IMHO- isn't really worth it - better to use C++ with assembly, then.
Using a C lib from assembly is easy.
Using C++ can get nasty because of name decoration, and -IMHO- isn't really worth it - better to use C++ with assembly, then.
Thanks f0dder, I figured as much but it would've be nice to keep it all into one language.
If this was a bit easier in assembler I'm sure there would be a lot more people using it. :)
Using a C lib from assembly is easy.
Using C++ can get nasty because of name decoration, and -IMHO- isn't really worth it - better to use C++ with assembly, then.
Thanks f0dder, I figured as much but it would've be nice to keep it all into one language.
If this was a bit easier in assembler I'm sure there would be a lot more people using it. :)
Well, it CAN be done for most stuff - use "SYSCALL" for the MASM protos, figure out what kind of name mangling your compiler uses (this *will* differ from compiler to compiler), figure out where to put "this" (register or stack), etc... it's not pretty. Macros can probably help, but still.
Well, it CAN be done for most stuff - use "SYSCALL" for the MASM protos, figure out what kind of name mangling your compiler uses (this *will* differ from compiler to compiler), figure out where to put "this" (register or stack), etc... it's not pretty. Macros can probably help, but still.
Ok, would dumpbin be suitable for figuring out the name mangling?
It seems I have a lot of study to do to fully understand what's happening here and I will do a bit more searching through threads here, though if anyone has any usefull links to any articles of what's involved that would be great.
thanks again.
Doh!, I just seen the gtk/xwindows forum :shock:
I will still do some study on this as it would be nice to use 3rd party libs when needed without haveing to chop and change languages.
I will still do some study on this as it would be nice to use 3rd party libs when needed without haveing to chop and change languages.
MickD,
Have a look at this thread :
Calling C++ functions from MASM :
http://www.asmcommunity.net/board/index.php?topic=25265.0
Have a look at this thread :
Calling C++ functions from MASM :
http://www.asmcommunity.net/board/index.php?topic=25265.0
Thanks Vortex, there's a bit there to soak up for me though :) I probably need to better understand how the inner workings of C++ classes work before the penny drops though. I have a good grip on OOP from using C#/++ for the last few years and I know that member functions are associated to vtables etc. but how they are mapped and how to inherit from or create instances of these objects and call their methods I need to get a grip on.
Cheers,
Mick.
Cheers,
Mick.
My way to learn C++'s classes handling, in order to create an OOP extention to asm, was by making different types of simple classes and looking at the compilation output (the asm/disasm). The resulting extention to asm is "ATC" at ultranos.com/asm . ObjAsm32 seems to support arbitrary C++ classes, too.
The only problem is the decoration of class-method names - you have to manually find these decorated names from the .obj files.
The only problem is the decoration of class-method names - you have to manually find these decorated names from the .obj files.
Thanks for the tip, that sounds like a good plan.
I'll start with a very simple class as you say then build on it with inheritance etc. and see what goes on.
It is a bit daunting to just open up a huge asm file and start looking for answers :shock:
Cheers,
Mick.
I'll start with a very simple class as you say then build on it with inheritance etc. and see what goes on.
It is a bit daunting to just open up a huge asm file and start looking for answers :shock:
Cheers,
Mick.