Author Topic: Using NASM as a C library (Windows .lib or .dll)  (Read 13635 times)

Offline suctiondart

  • Jr. Member
  • *
  • Posts: 2
Using NASM as a C library (Windows .lib or .dll)
« 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!

Offline Rob Neff

  • Forum Moderator
  • Full Member
  • *****
  • Posts: 429
  • Country: us
Re: Using NASM as a C library (Windows .lib or .dll)
« Reply #1 on: July 26, 2011, 09:37:27 PM »
Not without hacking it.  You may want to look at Yasm although I'm not sure if it's interface is what you're after.

Offline suctiondart

  • Jr. Member
  • *
  • Posts: 2
Re: Using NASM as a C library (Windows .lib or .dll)
« Reply #2 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!

Offline Eccentro

  • Jr. Member
  • *
  • Posts: 25
Re: Using NASM as a C library (Windows .lib or .dll)
« Reply #3 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.
« Last Edit: August 08, 2011, 11:40:46 AM by Eccentro »