Archived

This topic is now archived and is closed to further replies.

External ASM libraries

This topic is 5867 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

Hello. I have decided to go back to DJGPP for my OS programming, along with NASM. I dislike its form of inline assembly, so could I use NASM to write assembly routines, and link them with the C program, by simply calling a function or something? If so, how can you do this? Any resources? Thanks. I am not worthy of a sig!

Share this post


Link to post
Share on other sites
Both C and assembly produce - or should I say are capable of producing - the same form of intermediate/object files (compiled code). Combining them into an executable is simply a case of linking them, but the linker must be able to find symbol names and resolve all externals. Look up "C name mangling" and "ASM name mangling" so you can figure out the proper way to name your procedures in both languages and how to call them.

I seem to remember Rick Booth covering this briefly in Inner Loops (good book on Assembly optimizations; recommended reading).

Share this post


Link to post
Share on other sites