The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: Richard van Petrov on June 06, 2010, 06:33:15 PM

Title: Static Library
Post by: Richard van Petrov on June 06, 2010, 06:33:15 PM
How do I create a static library in MASM to embed into other applications? [RESOLVED]

.486
.model flat, stdcall
option casemap:none

include python26.inc

includelib python26.lib

.code

start:
    invoke Py_Initialize

    invoke Py_Finalize
    invoke ExitProcess, 0
end start
Title: Re: Static Library
Post by: ragdog on June 06, 2010, 08:01:58 PM
Hi

here is an example

python26.asm


  .486
  .model flat, stdcall  ; 32 bit memory model
  option casemap :none  ; case sensitive

  include \masm32\include\windows.inc
  include \masm32\include\user32.inc

  includelib \masm32\lib\user32.lib

  .code


Py_Initialize proc

ret
Py_Initialize endp

Py_Finalize proc
       ret
Py_Finalize endp
end


Add In your include file python26.inc


Py_Initialize PROTO
Py_Finalize  PROTO



Create a bat or cmd and paste it


c:\masm32\bin\ml /c /coff python26.asm
c:\masm32\bin\link -lib python26.obj /out:python26.lib
pause


greets,

Title: Re: Static Library
Post by: Richard van Petrov on June 06, 2010, 08:52:29 PM
Thank you, I have it working.
Title: Re: Static Library
Post by: Tedd on June 06, 2010, 10:06:43 PM
I would guess python functions will require C calling convention, which will make a difference when you have parameters to push.