NASM - The Netwide Assembler

NASM Forum => Using NASM => Topic started by: suctiondart on July 26, 2011, 11:54:01 AM

Title: Using NASM as a C library (Windows .lib or .dll)
Post by: suctiondart on July 26, 2011, 11:54:01 AM
Can NASM be used (or compiled) for use as a Windows .lib or .dll library?  I would like to be able to call it's assembler functionality programmatically, e.g. someFunctionNameLike_NasmAssemble("pop eax") and have it return the x86 binary op codes.

Thanks for the help!
Title: Re: Using NASM as a C library (Windows .lib or .dll)
Post by: Rob Neff on July 26, 2011, 09:37:27 PM
Not without hacking it.  You may want to look at Yasm (http://yasm.tortall.net/) although I'm not sure if it's interface is what you're after.
Title: Re: Using NASM as a C library (Windows .lib or .dll)
Post by: suctiondart on July 27, 2011, 12:44:44 AM
Thanks for the advice.  I am looking through Yasm (libyasm) to see if I can find the interface I want.  It doesn't appear to be able to assemble programmatically, but it has quite a few options (plus it is created to be used as a library).

If I cannot get it to work, I'll try to hack at the NASM source and try to convert it to a library.

If I do find a good library for this, I will post to the forum.  Thanks again!
Title: Re: Using NASM as a C library (Windows .lib or .dll)
Post by: Eccentro on August 08, 2011, 07:46:47 AM
suctiondart,

Microsoft has an inline assembler.  I tried it.  It caused my PC to hang whenever the VB6 environment elected to scan the source code while I was editing.

I'll be taking a look at Yasm, too.  Thanks, Rob, for that tip.