flat assembler
Message board for the users of flat assembler.
Index
> Windows > Creating a static *.lib file for use in VC++ |
Author |
|
Jeff Blue 24 Mar 2005, 13:22
Can no one give me a hint or something please?
|
|||
24 Mar 2005, 13:22 |
|
mike.dld 24 Mar 2005, 14:07
With MSVC you may use MS COFF format which is supported by FASM.
|
|||
24 Mar 2005, 14:07 |
|
Jeff Blue 24 Mar 2005, 15:11
I would love to use the MS COFF format but I get > 1000 errors if i change
format PE GUI 4.0 DLL to format MS COFF The DLL is over 150kb in size (compiled). |
|||
24 Mar 2005, 15:11 |
|
flaith 24 Mar 2005, 15:23
The only way i know to make a lib (.a or .lib) from a DLL is that way:
1st : Must have binutils from mingw (at least PEXPORTS.EXE and DLLTOOL.EXE) 2nd: pexports mydll.dll > mydll.def 3rd: dlltool -d mydll.def -l libmydll.a (or libmydll.lib) |
|||
24 Mar 2005, 15:23 |
|
Jeff Blue 24 Mar 2005, 16:32
thx flaith but that does not create a static lib file.
|
|||
24 Mar 2005, 16:32 |
|
mike.dld 24 Mar 2005, 18:05
Where do you get these errors? In VC or FASM or somewhere else? And what these errors are actually about?
|
|||
24 Mar 2005, 18:05 |
|
Jeff Blue 24 Mar 2005, 21:42
I can not even compile the DLL code with the MS COFF flag. This DLL is extrem HUGE. Every time i fix an error i get 3 new ones.
|
|||
24 Mar 2005, 21:42 |
|
mike.dld 24 Mar 2005, 21:54
Have you tried to declare all import functions as extrn and all export functions as public?
|
|||
24 Mar 2005, 21:54 |
|
Jeff Blue 25 Mar 2005, 08:37
I have done that but I can't link the *.obj file in VC.
FASM extrn VirtualFree:dword VC error Enforcer error LNK2001: unresolved external symbol VirtualFree Thats with all extrn functions |
|||
25 Mar 2005, 08:37 |
|
Vortex 26 Mar 2005, 22:03
Hi Jeff Blue,
Here is a simple demonstration on building and using a simple static library. The StdOut function to print NULL terminated strings (Original codes from the masm32 package ) Code: format MS COFF public StdOut as '_StdOut@4' extrn '__imp__GetStdHandle@4' as GetStdHandle:dword extrn '__imp__WriteFile@20' as WriteFile:dword extrn '__imp__lstrlenA@4' as lstrlen:dword Include '%fasminc%\win32a.inc' section '.code' code readable executable proc StdOut,lpszText hOutPut dd ? bWritten dd ? sl dd ? enter invoke GetStdHandle,STD_OUTPUT_HANDLE mov [hOutPut], eax invoke lstrlen,[lpszText] mov [sl],eax lea eax,[bWritten] invoke WriteFile,[hOutPut],[lpszText],[sl],eax,NULL mov eax,[bWritten] return endp The locate function: Code: format MS COFF public locate as '_locate@8' extrn '__imp__GetStdHandle@4' as GetStdHandle:dword extrn '__imp__SetConsoleCursorPosition@8' as SetConsoleCursorPosition:dword Include '%fasminc%\win32a.inc' section '.code' code readable executable proc locate,x,y _hOutPut dd ? xyVar dd ? enter invoke GetStdHandle,STD_OUTPUT_HANDLE mov [_hOutPut], eax mov ecx,[x] mov eax,[y] shl eax, 16 mov ax, cx invoke SetConsoleCursorPosition,[_hOutPut],eax return endp The example code using the static library: Code: format MS COFF public _start Include '%fasminc%\win32a.inc' extrn '__imp__ExitProcess@4' as ExitProcess:dword extrn '_StdOut@4' as StdOut:dword extrn '_locate@8' as locate:dword section '.data' data readable writeable msg db 'Console application',0 section '.code' code readable executable _start: push esi xor esi,esi @@: inc esi stdcall locate,esi,esi stdcall StdOut,msg cmp esi,10 jne @b pop esi invoke ExitProcess,0 Building the library and the final executable: Code: set fasminc=\fasmw\include \fasm\fasm StdOut.asm \fasm\fasm locate.asm \fasm\fasm Conssamp.asm \masm32\bin\lib /OUT:console.lib StdOut.obj locate.obj \masm32\bin\link /SUBSYSTEM:CONSOLE /ENTRY:start /LIBPATH:c:\masm32\lib\ Conssamp.obj console.lib kernel32.lib user32.lib
_________________ Code it... That's all... |
|||||||||||
26 Mar 2005, 22:03 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.