Category : OS/2 Files
Archive   : RUNDLL.ZIP
Filename : CALLDLL2.C

Output of file : CALLDLL2.C contained in archive : RUNDLL.ZIP
calldll2.c -- run-time dynamic linking to CRTLIB.DLL, using PROC1.C
requires MSC 5.1 CRTEXE.OBJ

cl -AL -c calldll2.c proc1.c
link /nod/noi crtexe.obj calldll2 proc1,calldll2,,crtlib.lib os2;

Hello from calldll2
Hello again, using new ANSI C style
_printf lives at 03EF:1098
printf returned 27

#include "procaddr.h"

typedef ULONG (far cdecl *CFN)();

main(int argc, char *argv[])
WORD (far cdecl *printf)();
WORD crtlib;
WORD ret;

crtlib = loadmodule("CRTLIB");
printf = (CFN) getprocaddr(crtlib, "_printf");
(*printf)("Hello from %s\n", argv[0]); /* 1 */
printf("Hello again, using new ANSI C style\n"); /* 2 */
ret = printf("_printf lives at %Fp\n", printf); /* 3 */
printf("printf returned %d\n", ret); /* 4 */
((CFN) getprocaddr(loadmodule("CRTLIB"),"_printf"))("Goodbye"); /* 5 */

  3 Responses to “Category : OS/2 Files
Archive   : RUNDLL.ZIP
Filename : CALLDLL2.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: