flat assembler
Message board for the users of flat assembler.
Index
> Windows > COFF OBJ FILES AND DLL's |
Author |
|
roticv 30 Sep 2004, 13:35
|
|||
30 Sep 2004, 13:35 |
|
metalfishx 30 Sep 2004, 14:07
Thanks rotic.. but maybe is because im new ussing assembly language, but i cannot see how to use that you give to me my poor experience is ussing MASM32
Here i atach the code that im trying to convert to obj.. i just need a dll, but in obj format (if is possible) Code: format PE GUI 4.0 DLL entry DllEntryPoint include '%fasminc%\win32a.inc' section '.data' data readable writable vaintret dd ? varstrret db "Hello World!!!" section '.code' code readable executable proc DllEntryPoint, hinstDLL,fdwReason,lpvReserved mov eax,TRUE return endp proc testint,param1 mov eax,[param1] add eax,100 mov [vaintret],eax mov eax,vaintret return endp proc teststr mov eax,varstrret return endp section '.edata' export data readable export 'testobj.dll',\ testint,'testing',\ teststr,'teststr' section '.reloc' fixups data discardable _________________ --------------------------------------- Roberto A. Berrospe Machin Ruta Internet, Florida Uruguay --------------------------------------- |
|||
30 Sep 2004, 14:07 |
|
roticv 30 Sep 2004, 16:42
Replace the format PE GUI 4.0 DLL with format MS COFF
|
|||
30 Sep 2004, 16:42 |
|
metalfishx 30 Sep 2004, 17:17
Hi roticv. Well yes, i was testing some formats.. if i use format MS COFF fasm give me an error in: entry DllEntryPoint, and if i remove that, then i receive an error in: section '.edata' export data readable ... i cannot find the way to do this.. but thanks for your recomendations.
|
|||
30 Sep 2004, 17:17 |
|
pelaillo 30 Sep 2004, 17:54
metalfishx,
entry point and exports are to be decided when linking final dll (or exe) file. COFF format does not hold this information because they could be linked in different ways and with different formats/products (releases). i.e. the flexibility of COFF format permit you to produce one time a standalone exe and another time a dll with the same object files. |
|||
30 Sep 2004, 17:54 |
|
Vortex 30 Sep 2004, 18:19
Hi metalfishx,
Here is an example for you. Consider this DLL source code exporting these two functions translated from Hutch's masm32.lib : Code: StdOut : prints a NULL terminated string locate : puts the cursor to the coordinates x,y Consfunc.asm Code: format MS COFF public DllEntryPoint public StdOut public locate extrn GetStdHandle:dword extrn SetConsoleCursorPosition:dword extrn WriteFile:dword extrn 'lstrlenA' as lstrlen:dword Include '%fasminc%\win32a.inc' section '.code' code readable executable proc DllEntryPoint, hinstDLL,fdwReason,lpvReserved mov eax,TRUE return endp 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 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 Creating the DLL with the linker GoLink authored by Jeremy Gordon: http://www.godevtool.com Code: set fasminc=\fasmw\include \fasm\fasm Consfunc.asm \goasm\golink /dll /entry DllEntryPoint /export StdOut /export locate Consfunc.obj kernel32.dll An example using this DLL: Code: format PE CONSOLE 4.0 entry start Include '%fasminc%\win32a.inc' Include '%fasminc%\macro\if.inc' section '.data' data readable writeable msg db 'Console application',0 section '.code' code readable executable start: push esi xor esi,esi @@: inc esi invoke locate,esi,esi invoke StdOut,msg cmp esi,10 jne @b pop esi invoke ExitProcess,0 section '.idata' import data readable writeable library kernel32,'kernel32.dll',\ Consfunc,'Consfunc.dll' import kernel32,\ ExitProcess,'ExitProcess' import Consfunc,\ StdOut,'StdOut',\ locate,'locate' If you would like to create an import library for this DLL, please let me know.
_________________ Code it... That's all... |
|||||||||||
30 Sep 2004, 18:19 |
|
metalfishx 01 Oct 2004, 12:41
Thanks a lot.. for the answers, works fine! and i know now how to use externals with "extern" Thanks to all!
_________________ --------------------------------------- Roberto A. Berrospe Machin Ruta Internet, Florida Uruguay --------------------------------------- |
|||
01 Oct 2004, 12:41 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.