Mail Archives: djgpp/1996/10/27/10:56:02
From: | Ryzhenkov Ilya <ilya AT spy DOT isp DOT nsc DOT ru>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Dynamic Link Modules
|
Date: | Fri, 25 Oct 1996 15:01:43 -0700
|
Organization: | ISPh SB RAS
|
Lines: | 91
|
Distribution: | world
|
Message-ID: | <327138C7.27BD@spy.isp.nsc.ru>
|
NNTP-Posting-Host: | arab.isp.nsc.ru
|
Mime-Version: | 1.0
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Hi!
I'm developing Dynamic Link Modules (DLM) environment for djgpp and now it's
in a week from first release.
Breafly :
1. It's a real run-time link. Modules can have unresolved external references and
functions maybe called directly (i.e. not by pointer to function)
Just to be sure that none of unresolved function & data actually uses, they
are resolved to 0xffffffff address to cause a gpf on use. It maybe used
in future, by catching exception and, for example, auto-loading desired DLM.
2. DLM may reference each other in any way. (consider the following example)
3. DLM's maybe loaded and unloaded dynamicaly, so they may be used as overlays.
As now begins a period of testing (and actually writing stub which will load
main DLM, export functions for DLM operating and start program), I need help
and assistance. If anyone is interested and can help or suggest, or just talk about
DLM - welcome to subscribe to the mailing list :
mailto: maiser AT spy DOT isp DOT nsc DOT ru
in body : subscribe djgpp-dlm
History of DLM developing is at http://spy.isp.nsc.ru/djgpp/dll.htm
Here is example of using DLM :
there were two files (test1.c & test2.c), each was converted into
separate DLM, they were loaded and start() was called.
======= File test1.c =====
#include <stdio.h>
int i;
char *strings[4] = { "str1","str2","str3","str4" };
extern void test2(char *text);
void test1(void)
{
printf("That's FINAL! This printf is from test1.dlm/test1()\n");
};
void start(void)
{
printf("TEST1 started ....\n");
printf("Printing strings from test1...\n");
for (i=0; i<4; i++) printf("String : '%s' \n",strings[i]);
printf("Now calling test2 ...\n");
test2("<<TEST1 param>>");
printf("back in test1...\n");
printf("exiting...\n");
};
======= File test2.c =====
#include <stdio.h>
extern char *strings[];
extern i;
extern void test1(void);
void test2(char *text)
{
printf("TEST2 called ! Param from test1 is '%s'\n",text);
printf("Printing strings from test2...\n");
for (i=0; i<4; i++) printf("String : '%s' \n",strings[i]);
printf("Calling back test1 ...\n");
test1();
printf("Returned from test1 and now ");
printf("exiting...\n");
};
======== OUTPUT =======
TEST1 started ....
Printing strings from test1...
String : 'str1'
String : 'str2'
String : 'str3'
String : 'str4'
Now calling test2 ...
TEST2 called ! Param from test1 is '<<TEST1 param>>'
Printing strings from test2...
String : 'str1'
String : 'str2'
String : 'str3'
String : 'str4'
Calling back test1 ...
That's FINAL! This printf is from test1.dlm/test1()
Returned from test1 and now exiting...
back in test1...
exiting...
--
Sincerely yours, Ilya
mailto:ilya AT spy DOT isp DOT nsc DOT ru
http://spy.isp.nsc.ru
- Raw text -