Dynamic library example Hi,
i've programmed a simple dynamic library system for menuet.
the principe is that the mdl (menuet dynamic library) is a binary file, loaded as a normal file), it containt in the header the adress from each function.
The function parameter are pushed in the stack before you call the function.
and the returned value is placed in the stack
you can resolve the function adress with the macro:
mdl_get_fn_addr fn_num , fn_ptr
the example code is a implementation of the IPC system from menuet
the function in the library are
dd get_pid ( dword get_pid (char* proc_name_ptr) )
dd send ( dword send(dword pid,char * msg_data_ptr, dword msg_len) )
dd init ( void init() )
dd receive ( ipc_message* receive() )
get_pid return the pid from the procces that the name is in proc_name_ptr
send is for sending a message to a process identified with the pid, you must specify the message len
init initialize the ipc - message area
return the adress of the received ipc-message
ipc_message* is the adress of a ipc_message that contain :
+0 dd sender pid
+4 dd message len
+8 db message data
the file contain:
client source code (.asm)
server source code (.asm)
library source code (.asm)
mdl implementation include file (.inc)
client binary file
server binary file
library binary file (.mdl) (you must copy this file in /hd0/1/kolibri/lib
Download IPC2.ZIP => http://stephaneweg.cabspace.com/files/ipc2.zip
Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.