NASM Forum > Programming with NASM

Using a C library with NASM without needing GCC

(1/1)

mayureshkathe:
I saw the tutorial at https://cs.lmu.edu/~ray/notes/nasmtutorial/  (Using a C Library).
It has an example to show usage of a C library with NASM, but the build process depends on GCC.
Is there any way to use an external non-assembly library with assembly using NASM?

Frank Kotler:
Sure. You think HLLs have instructions that Nasm doesn't know?

It is much easier to use a linker. You'll have to figure out the command line to the linker. GCC knows the command line to tell the linker. Why don't you want to use it?

You'll need "-lc" and probably "-L(path to library)" - maybe others... I've lost my examples...
("--nostartfiles" to GCC to get rid of "main" as I recall)

Best,
Frank

mayureshkathe:
I am currently learning assembler using NASM via books by Duntemann and others from Apress.
My long term ambition is to build a high-performance, high-precision, error-free library for numerical computing and then build applications using the same under macOS using it's AppKit UI library via the Metal interface.
I don't want to have the burden of downloading the entire XCode environment when all I need is an assembler and linker which I can ask a friend to build an installable package of.

Navigation

[0] Message Index

Go to full version