Path: utzoo!utgpu!water!watmath!clyde!bellcore!decvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!enea!erix!erialfa!kjelle From: kjelle@erialfa.UUCP (Kjell Eriksson) Newsgroups: comp.sys.ibm.pc Subject: Shared Libraries in OS/2. How? Message-ID: <182@erialfa.UUCP> Date: 12 Feb 88 14:05:30 GMT Reply-To: kjelle@erialfa.UUCP (Kjell Eriksson) Organization: Ericsson Information Systems AB, Kista, Stockholm, SWEDEN Lines: 43 When you call a dynamicly linked function in OS/2 how do switch data areas. The 'static int a' in the example below. The 'usefulfunc' is used by 2 or more different tasks. Example: A dynamic library source. ----------------------------------- static int a; /* there will be one copy of this per task */ int far pascal usefulfunc(int parm) { return parm + a; } ----------------------------------- the definition file ----------------------------------- library dynalib code sharable ; I assume that this means multiple tasks can ; use the same copy. Code is 'pure' (read-only). data multiple ; I assume that this means one instance per task ; of the library entry usefulfunc ----------------------------------- The integer 'a' above will end up in a segment of it own and the code in the return statement will address relative to the ds-register. When 'usefulfunc' is called, DS is pointing at the callers data segment. How does DS get changed and where is that value stored? Whose responsablitity is it? The caller or the called. Your confused Kjell E. -- Kjell Eriksson Phone: + 46 8 7937844 Telefax: 7509851 Ericsson Information Systems AB Telex: 15968 ericki s S-163 98 Stockholm UUCP: ...!mcvax!enea!erix!erialfa!kjelle SWEDEN kjelle@erialfa.UUCP