[comp.os.os2.programmer] Making a DLL...

rol@grasp1.univ-lyon1.fr (Paul Rolland) (04/16/91)

Hi networkers,

    I'm trying to make a DLL for an OS/2 multi tasking program. I've written
my C program, compile it with the following options:
  cl -FPa -Alfu -DDLL -W3 -G2s -c prog.c
Then I link it with the following command:
  link prog /noi,dll.dll,,crtlib.lib doscalls.lib /nod,dll.def;
with dll.def containing:
  LIBRARY DLL
  DESCRIPTION 'my prog'
  EXPORTS
    _myproc  (with or without @1)

I then use it in another prog, but when I start it, I get the following message
SYS2070: Ths system could not demand load the
application's segment. DLL _MYPROC is in error.
For additional information also see message SYS0127.

My questions are : what does this message mean ? Where have I done an error ?
And where can I found a description of these messages ?????

	Thanks in advance.
	Please reply by Email at rol@grasp1.univ-lyon1.fr

 Paul Rolland, engineer [I hope :)] in July 91,
 Specialist of assembly on PC [Not too bad in fact :)],
 Trying to progress on Unix administration
 					   Email : rol@grasp1.univ-lyon1.fr 

slh@gibdo.engr.washington.edu (04/17/91)

In article <1991Apr15.184434.14562@grasp1.univ-lyon1.fr> rol@grasp1.univ-lyon1.fr (Paul Rolland) writes:
|Hi networkers,
|
|    I'm trying to make a DLL for an OS/2 multi tasking program. I've written
|my C program, compile it with the following options:
|  cl -FPa -Alfu -DDLL -W3 -G2s -c prog.c
|Then I link it with the following command:
|  link prog /noi,dll.dll,,crtlib.lib doscalls.lib /nod,dll.def;
				      ------------
	on thing I see is you need to link with the dll version of the library
	(LLIBDLL.LIB, I think is the name)

towfiq@FTP.COM (Mark Towfiq) (04/17/91)

>>>>> On Mon, 15 Apr 1991 18:44:34 GMT, rol@grasp1.univ-lyon1.fr (Paul Rolland) said:

Paul> I'm trying to make a DLL for an OS/2 multi tasking program. I've written
Paul> my C program, compile it with the following options:
Paul>   cl -FPa -Alfu -DDLL -W3 -G2s -c prog.c

So far, so good.

Paul> Then I link it with the following command:
Paul>   link prog /noi,dll.dll,,crtlib.lib doscalls.lib /nod,dll.def;
Paul> with dll.def containing:
Paul>   LIBRARY DLL
Paul>   DESCRIPTION 'my prog'
Paul>   EXPORTS
Paul>     _myproc  (with or without @1)

>>>>> On 17 Apr 91 11:08:27 GMT, slh@gibdo.engr.washington.edu said:

slh> one thing I see is you need to link with the dll version of the
slh> library (LLIBDLL.LIB, I think is the name)

That's right, since he is building a DLL he needs to like either with
LLIBCDLL, or, if his application and DLL have to share C run-time
information, such as the variable errno, or file i/o streams, he must
use the customized CRTLIB (this is what FTP did for our PC/TCP
Developer's Toolkit).

Paul> I then use it in another prog, but when I start it, I get the
Paul> following message:

Paul> SYS2070: Ths system could not demand load the
Paul> application's segment. DLL _MYPROC is in error.
Paul> For additional information also see message SYS0127.

Paul> My questions are:

Let's take them one at a time.

Paul> What does this message mean?

It means that the application is looking for a function called _MYPROC
in the DLL module, but that it is not there.

Paul> Where have I done an error?

You have forgotten to link your application with /NOI, case
insensitivity, so that the application is looking for _MYPROC, when
you really want it to find _myproc.  You should really also link with
/NOD and /NOE, in my experience.

Paul> And where can I found a description of these messages ?????

Use the "helpmsg" command: "helpmsg sys0127" will give you more
details.

Hope this helps,
Mark

--
Mark Towfiq, FTP Software, Inc.                                  towfiq@FTP.COM
Work No.: +1 617 246 0900			      Home No.: +1 617 488 2818

  "The Earth is but One Country, and Mankind its Citizens" -- Baha'u'llah

larrys@watson.ibm.com (Larry Salomon, Jr.) (04/17/91)

That "cannot demand load the application segment" means that it could not
load the DLL.  Check to make sure that the DLL is in the LIBPATH.

Cheers,
Larry Salomon, Jr. (aka 'Q')            LARRYS@YKTVMV.BITNET
OS/2 Applications and Tools             larrys@ibmman.watson.ibm.com
IBM T.J. Watson Research Center         larrys@eng.clemson.edu
Yorktown Heights, NY

Disclaimer:  The statements and/or opinions stated above are strictly my
own and do not reflect the views of my employer.

towfiq@FTP.COM (Mark Towfiq) (04/18/91)

>>>>> On 17 Apr 91 12:54:37 GMT, larrys@watson.ibm.com (Larry Salomon, Jr.) said:

Larry> That "cannot demand load the application segment" means that it
Larry> could not load the DLL.

Well, sort of...it means that it found the DLL, but not all the
functions it wanted were in there.  When OS/2 can't find a DLL, it
says "The system cannot find the file XXX.".

Larry> Check to make sure that the DLL is in the LIBPATH.

This won't help!
--
Mark Towfiq, FTP Software, Inc.                                  towfiq@FTP.COM
Work No.: +1 617 246 0900			      Home No.: +1 617 488 2818

  "The Earth is but One Country, and Mankind its Citizens" -- Baha'u'llah

gerry@dialogic.com (Gerry Lachac) (04/18/91)

In article <1991Apr17.125438.8040@watson.ibm.com> larrys@yktvmv writes:
>That "cannot demand load the application segment" means that it could not
>load the DLL.  Check to make sure that the DLL is in the LIBPATH.
>

The message I get when OS/2 can't find the DLL goes something like:

"cannot load XXXXXX"

where XXXXXX is the name of the DLL without the .DLL extension.

-gerry


-- 
uunet!dialogic!gerry   | "Even a dead plant turns  |	Dialogic Corporation
	OR	       |  over a new leaf 	   |	300 Littleton Rd
gerry@dialogic.UUCP    |  when the wind blows."	   |	Parsippany, NJ 07054 
		       |  			   |	(201)334-8450