🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.os2.programmer
Article #2942

Re: DLL question

#2942
From: David Charlap
Date: Fri, 18 Dec 1992 20:46
36 lines
2200 bytes
In article <lj1ktuINNftf@exodus.Eng.Sun.COM> deepakd@ural.Eng.Sun.COM (Deepak Dhamdhere) writes:
>I have an application that calls functions from ABC.DLL,
>those functions call routines from XYZ.DLL and those, in turn,
>call routines from the C library. This application starts a child process
>using DosExecPgm, which in turn, does the same thing. I have used 
>llibcdll.lib to link all these programs and libraries. 

Are you also using the compiler switches to ensure that DS!=SS and
that DS is always loaded on process entry.  I think these are in the
keyword EXPENTRY.  I believe that any functions you export to a DLL
must be declared with this.

>Very frequently, it generates a segementation violation. When I checked
>with Codeview, I found that the malloc() call fails because it tries to
>load a non-existent segment into DS.

It sounds like the DLL is (correctly) assuming that DS!=SS, and is
loading it, but the calling program isn't providing the segment.  Be
sure that the code and headers are using the EXPENTRY keyword for all
exported functions.

>Any clues to why is this happening ? I would like to know the correct
>way of compiling and linking ABC.DLL, XYZ.DLL and the applications.

In general, I don't like to call C run-time functions from DLL's, but
that's a different story.  Some compilers (like EMX/GCC) have the C
library functions in a DLL, so there's little linkage problems, but
you can't do that with MS-C.



-- 
  |)  David Charlap          | .signature confiscated by FBI due to
 /|_  dic5340@hertz.njit.edu | an ongoing investigation into the
((|,)                        | source of these .signature virusses
 ~|~
Technical Details
Message-ID: <1992Dec18.204637.2448@njitgw.njit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340
References: <lj1ktuINNftf@exodus.Eng.Sun.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!rutgers!njitgw.njit.edu!hertz.njit.edu!dic5340
From: dic5340@hertz.njit.edu (David Charlap)
Newsgroups: comp.os.os2.programmer,comp.os.os2.apps,comp.os.os2.misc
Subject: Re: DLL question
Keywords: DLL library
Message-ID: <1992Dec18.204637.2448@njitgw.njit.edu>
Date: 18 Dec 92 20:46:37 GMT
References: <lj1ktuINNftf@exodus.Eng.Sun.COM>
Sender: news@njit.edu
Organization: New Jersey Institute of Technology, Newark, N.J.
Lines: 36
Nntp-Posting-Host: hertz.njit.edu