DLL function entry in assembly

samir.ribic_at_alemsistem.com.ba
Date: 10/20/05


Date: 20 Oct 2005 01:46:00 -0700

I have made one small programming language (C like), called FILDZAN-32,
that work under Windows, and I teach on the University of Sarajevo, the
compiler construction course.

Many people found that the compiler can be useful also outside
academia, because the generated executable code can be quite small.
(Hello world on Windows is about 2 kilobytes executable).
The generated output is actually i486 assembly source, without
overload that crt0 gives to even smallest C program.

Some students will take the task porting the compiler to Linux. I have
looked at http://docs.cs.up.ac.za/programming/asm/derick_tut/
Because my compiler generates assembly source, with NASM this will be
quite easy job. It will be necessary to replace just several commands -
for example

PUSH 0
Call ExitProcess@4

need to be changed to

mov eax,1 ; The system call for exit (sys_exit)
mov ebx,0 ; Exit with return code of 0 (no error)
int 80h

The only problem is how to call routines that are not in kernel, but in
.so libraries. There is system function 86 called by int 80h with a
name "sys_uselib". It loads external library, but I do not know how to
get an entry point of some specific function.

For example, if I loaded libX11.so using sys_uselib, how to then find
the address of XPutPixel and call it?



Relevant Pages

  • Re: hmm..interesting
    ... you've got a discussion of ARM vs Intel architecture here: ... And ARM is rapidly running away from RISC. ... mainstream (many netbooks and smartphones run Linux instead of Windows ... And hardly any C compiler does. ...
    (comp.sys.acorn.hardware)
  • Re: Stalin ported to Windows.
    ... Therefore, the compiler ... Stalin from Scheme sources; it took six hours to generate the C ...   Junia and Reane  got a working Windows port from the C ...
    (comp.lang.scheme)
  • Re: hmm..interesting
    ... work out at more power per Watt than x86. ... mainstream (many netbooks and smartphones run Linux instead of Windows ... the fact that Visual Studio allows you to get away with fairly sloppy ... difficult to find a C compiler that *doesn't* have vendor-specific ...
    (comp.sys.acorn.hardware)
  • Re: C++ programming migration from DOS to Windows
    ... compiler, so the current compiler is quite competitive WRT to ... There are a couple of ports of gcc to Windows. ... Comeau is more or less unique: the best language conformance you can ... IDEs: Microsoft and Borland have both produced decent IDEs in the past, ...
    (comp.lang.cpp)
  • Re: Future for VC++ Programmers
    ... bluescreening the system (crash X windows). ... Especially the kind who speak their native language as a second ... I don't want an environment in which the compiler, the linker, and the debugger will, at ...
    (microsoft.public.vc.mfc)