Jump to content
  • Advertisement
Sign in to follow this  
luasitdown

why can I create class from a machine code?

This topic is 4837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I mean I can create class from lib or dll that consist of machine code. why?? and I think class concept belong to high level language.

Share this post


Link to post
Share on other sites
Advertisement
When you write an application your classes get broken down into machine code. It is able to function because it knows where in memory each of the components of each class has been stored. This is the same for DLLs. DLLs contain your classes and functions broken down into machine code as well as some very basic information about where some of its functionas are located, and since C++ knows where to look in memory it is able to import the dlls functionallity (It is more complicated than this, especially when dealing with explicitly linked DLLS, polymorphism, etc., but the basics are same.). LIBs are different. They don't contain machine code, they contain object code which stores more information about the codes high level structure. This gets combined with your application to create the resulting machine code.

Hope that was clear enough.

Share this post


Link to post
Share on other sites
Using a C++ compiler you can use the _ASM directive (which will probably be different depending on the compiler you use) to write methods in Assembler which is another name for machine language. Just keep in mind that to call other methods that they are indexed off of the THIS pointer.

Share this post


Link to post
Share on other sites
A class is one way of specifying the 'shape' of data. Low level code might be another way of doing it. How that data is set up doesn't matter in the end. So an object made in a high level language can easily cooperate with one made in a low level language if they follow the same specifications.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!