www.digitalmars.com         C & C++   DMDScript  

D - Linking Error?

reply "Keir Blatter" <keir verizon.xyz.net> writes:
any idea's on what to do about the following error message?

-----
C:\DMD\BIN\..\..\dm\bin\link.exe
RCT,,,opengl32.lib+glu32.lib+glaux.lib+winmm.lib+kernel32.lib+user32.lib+use
r32+kernel32,winsamp.def/noi;

OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

C:\DM\BIN\..\lib\opengl32.lib
 Error 43: Not a Valid Library File
--- errorlevel 1

was generated with the following command line

DMD RCT opengl32.lib glu32.lib winmm.lib kernel32.lib user32.lib winsamp.def
 err.txt

I've been converting a C demo to D and had been trucking along defining function prototype after prototype and then I got this. I'm at a loss about what to do next. Any ideas?
Feb 01 2003
next sibling parent "Jeroen van Bemmel" <anonymous somewhere.com> writes:
 C:\DM\BIN\..\lib\opengl32.lib
  Error 43: Not a Valid Library File
 --- errorlevel 1

 was generated with the following command line

 DMD RCT opengl32.lib glu32.lib winmm.lib kernel32.lib user32.lib

 err.txt

I've been converting a C demo to D and had been trucking along defining function prototype after prototype and then I got this. I'm at a loss

 what to do next.

 Any ideas?

Most likely the opengl32.lib is not in a library format that is recognised by the linker used by DMD. I know it generates OMF object files, but there are many others (COFF, ELF, ...) You could try to unwrap opengl32.lib with some other library tool (taking out the .obj files), and convert it to OMF format somehow. I've been using Microsoft's editbin.exe to convert OMF to COFF, there should be tools that do the reverse.
Feb 01 2003
prev sibling next sibling parent "Keir Blatter" <keir verizon.xyz.net> writes:
this LIB tool is pretty new to me

the opengl libraries were the ones downloaded from dedicated.com...
(LIB.EXE from dmc seems to be able to list it out fine.  Microsofts doesn't
appear to recognize it, it does however read its own from VC)

so, assuming that the DedicateD lib is out of date in some manner I'm trying
now to figure out how to recreate an OMF lib after extracting all the obj's
from the MS provided lib... except the MS /list simply repeates OPENGL.DLL
over and over...

I've now tried using borlands coff2omf from C Builder to convert the lib
from VC but I still get the error 43

"Keir Blatter" <keir verizon.xyz.net> wrote in message
news:b1hd2e$2tuo$1 digitaldaemon.com...
any idea's on what to do about the following error message?

-----
C:\DMD\BIN\..\..\dm\bin\link.exe
RCT,,,opengl32.lib+glu32.lib+glaux.lib+winmm.lib+kernel32.lib+user32.lib+use
r32+kernel32,winsamp.def/noi;

OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

C:\DM\BIN\..\lib\opengl32.lib
 Error 43: Not a Valid Library File
--- errorlevel 1

was generated with the following command line

DMD RCT opengl32.lib glu32.lib winmm.lib kernel32.lib user32.lib winsamp.def
 err.txt

I've been converting a C demo to D and had been trucking along defining function prototype after prototype and then I got this. I'm at a loss about what to do next. Any ideas?
Feb 02 2003
prev sibling parent reply "Keir" <keir verizon.xyz.net> writes:
soooo.... both Borland's (alledgedly OMF flavored) .lib nor MS's give me the
error 43 as they stand...

but Here is what I've done, and maybe appeased the mighty linker gods...

I extracted the modules inside each lib (opengl32, glu32 and winmm) and then
recreated the lib using the same lib tool.

the linker seems to find its way a little farther although now I have a
bunch of error 42's for, potentially, all the functions I need the libraries
for... hmmm... name mangling of some kind?

-----------
C:\DMD\BIN\..\..\dm\bin\link.exe
RCT,,,opengl32.lib+glu32.lib+winmm.lib+user32+kernel32,winsamp.def/noi;

OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

RCT.obj(RCT)
 Error 42: Symbol Undefined _wglMakeCurrent 8
RCT.obj(RCT)
 Error 42: Symbol Undefined _wglDeleteContext 4
RCT.obj(RCT)
 Error 42: Symbol Undefined _SwapBuffers 4
etc etc etc
-----------------


"Keir Blatter" <keir verizon.xyz.net> wrote in message

any idea's on what to do about the following error message?

-----
C:\DMD\BIN\..\..\dm\bin\link.exe
RCT,,,opengl32.lib+glu32.lib+glaux.lib+winmm.lib+kernel32.lib+user32.lib+use
r32+kernel32,winsamp.def/noi;

OPTLINK (R) for Win32  Release 7.50B1
Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

C:\DM\BIN\..\lib\opengl32.lib
 Error 43: Not a Valid Library File
--- errorlevel 1

was generated with the following command line

DMD RCT opengl32.lib glu32.lib winmm.lib kernel32.lib user32.lib winsamp.def
 err.txt

I've been converting a C demo to D and had been trucking along defining function prototype after prototype and then I got this. I'm at a loss about what to do next. Any ideas?
Feb 02 2003
parent reply "Jeroen van Bemmel" <anonymous somewhere.com> writes:
 RCT.obj(RCT)
  Error 42: Symbol Undefined _wglMakeCurrent 8
 RCT.obj(RCT)
  Error 42: Symbol Undefined _wglDeleteContext 4
 RCT.obj(RCT)
  Error 42: Symbol Undefined _SwapBuffers 4
 etc etc etc
 -----------------

These look familiar to me. It has indeed something to with name mangling, namely __fastcall calling convention symbols. I had a similiar problem with 'dmc', I found out that I had to use the '-mn' switch to get it to generate the correct symbolnames (with ). D's runtime system seems to expect these decorated names, perhaps you need to recompile the openGL library with other switches (if possible?) Linux' 'ld' has a feature to ignore / work around these decorations, look for 'stdcall' in ld's option list
Feb 02 2003
parent reply "Keir Blatter" <spam grok.ath.cx> writes:
I hunted through a lot of the old posts here and found that the last person
to try this also ran across several Error 42's although there wasn't any
mention of how it was overcome.

The thought of converting the opengl library to D had crossed my mind but I
haven't started poking around for a download for its source code.  I wasn't
entertaining much hope that it would be available.

"Jeroen van Bemmel" <anonymous somewhere.com> wrote in message
news:b1k6n1$1fjb$1 digitaldaemon.com...
 RCT.obj(RCT)
  Error 42: Symbol Undefined _SwapBuffers 4
 etc etc etc
 -----------------

These look familiar to me. It has indeed something to with name mangling, namely __fastcall calling convention symbols. I had a similiar problem

 'dmc', I found out that I had to use the '-mn' switch to get it to

 the correct symbolnames (with  ).

 D's runtime system seems to expect these decorated names, perhaps you need
 to recompile the openGL library with other switches (if possible?)

 Linux' 'ld' has a feature to ignore / work around these decorations, look
 for 'stdcall' in ld's option list

Feb 03 2003
next sibling parent "Lars Ivar Igesund" <larsivi stud.ntnu.no> writes:
 The thought of converting the opengl library to D had crossed my mind but

 haven't started poking around for a download for its source code.  I

 entertaining much hope that it would be available.

If you are thinking about a total reimplementation of the OpenGL specification, there is a couple of projects you could look at. Mesa (www.mesa3d.org) is an open source implementation with software rendering. It's license is quite liberal and a conversion to D would probably be welcomed. Mesa is also basis for some hardware drivers on *nix'es. SGI's original software implementation, has been released with full source. I think it implements OpenGL 1.2.1 and is called the sample implementation of OpenGL. It can be found at http://oss.sgi.com/projects/ogl-sample/ The problem with these, are that they only provides software rendering when in Windows (Mesa's hardware rendering on *nix'es are only for a few of the available cards, Radeon being the "best"). A new implementation cannot (in most cases) implement the driver bits needed to use installed hardware. An OpenGL program on Windows is linked against opengl32.lib. If no hardware is available, this lib provides software rendering. However, a hardware driver implemented using the Hardware driver kit for Windows (which I know little about) overrides this lib (opengl32.dll). This won't work with some other opengl-implementation (I think) which means that you lose hardware acceleration. Lars Ivar Igesund
Feb 03 2003
prev sibling parent Burton Radons <loth users.sourceforge.net> writes:
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Keir Blatter wrote:
 I hunted through a lot of the old posts here and found that the last person
 to try this also ran across several Error 42's although there wasn't any
 mention of how it was overcome.
 
 The thought of converting the opengl library to D had crossed my mind but I
 haven't started poking around for a download for its source code.  I wasn't
 entertaining much hope that it would be available.

I've attached the opengl32.def and .lib files I use for dig; it doesn't include most of the symbols. You can add symbols to the def file and recreate the lib using implib, which is from one of the DMC support packages, I don't know what one. Then copy the opengl32.lib to your \dm\lib directory. Here's the extern set for the symbols included: extern (Windows) { void glBegin (GLenum mode); void glBindTexture (GLenum target, GLuint texture); void glBlendFunc (GLenum sfactor, GLenum dfactor); void glCallList (GLuint list); void glClear (GLbitfield mask); void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); void glClearDepth (GLclampd depth); void glColor3f (GLfloat red, GLfloat green, GLfloat blue); void glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); void glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); void glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); void glCopyTexImage2D (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); void glCullFace (GLenum mode); void glDeleteLists (GLuint list, GLsizei range); void glDeleteTextures (GLsizei n, GLuint *textures); void glDepthFunc (GLenum func); void glDepthMask (GLboolean value); void glDepthRange (GLclampd zNear, GLclampd zFar); void glDisable (GLenum cap); void glDisableClientState (GLenum cap); void glDrawArrays (GLenum mode, GLint first, GLsizei count); void glEnable (GLenum cap); void glEnableClientState (GLenum cap); void glEnd (); void glEndList (); void glFogf (GLenum pname, GLfloat param); void glFogfv (GLenum pname, GLfloat *params); void glFogi (GLenum pname, GLint param); void glFogiv (GLenum pname, GLint *params); void glFlush (); void glFrontFace (GLenum mode); GLuint glGenLists (GLsizei range); void glGenTextures (GLsizei n, GLuint *textures); void glGetBooleanv (GLenum pname, GLboolean *params); void glGetDoublev (GLenum pname, GLdouble *params); GLenum glGetError (); void glGetFloatv (GLenum pname, GLfloat *params); void glGetIntegerv (GLenum pname, GLint *params); void glGetLightfv (GLenum light, GLenum pname, GLfloat *params); void glGetLightiv (GLenum light, GLenum pname, GLint *params); void glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params); void glGetMaterialiv (GLenum face, GLenum pname, GLint *params); GLubyte *glGetString (GLenum name); void glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels); void glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params); void glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params); void glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); void glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); void glHint (GLenum target, GLenum mode); GLboolean glIsEnabled (GLenum cap); void glLightfv (GLenum light, GLenum pname, GLfloat *params); void glLightModelf (GLenum pname, GLfloat param); void glLightModelfv (GLenum pname, GLfloat *param); void glLightModeli (GLenum pname, GLint param); void glLineWidth (GLfloat value); void glLoadIdentity (); void glLogicOp (GLenum opcode); void glMaterialfv (GLenum face, GLenum pname, GLfloat *params); void glMatrixMode (GLenum mode); void glMultMatrixd (GLdouble *m); void glMultMatrixf (GLfloat *m); void glNewList (GLuint list, GLenum mode); void glNormal3f (GLfloat x, GLfloat y, GLfloat z); void glNormal3fv (GLfloat *v); void glNormalPointer (GLenum type, GLsizei stride, GLvoid *pointer); void glPixelStoref (GLenum pname, GLfloat param); void glPixelStorei (GLenum pname, GLint param); void glPointSize (GLfloat size); void glPolygonMode (GLenum face, GLenum mode); void glPolygonOffset (GLfloat factor, GLfloat units); void glPopMatrix (); void glPushMatrix (); void glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); void glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); void glScalef (GLfloat x, GLfloat y, GLfloat z); void glStencilFunc (GLenum func, GLint ref, GLuint mask); void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); void glTexCoord2f (GLfloat x, GLfloat y); void glTexCoordPointer (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); void glTexGend (GLenum coord, GLenum pname, GLdouble param); void glTexGendv (GLenum coord, GLenum pname, GLdouble *params); void glTexGenf (GLenum coord, GLenum pname, GLfloat param); void glTexGenfv (GLenum coord, GLenum pname, GLfloat *params); void glTexGeni (GLenum coord, GLenum pname, GLint param); void glTexGeniv (GLenum coord, GLenum pname, GLint *params); void glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, GLvoid *pixels); void glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, GLvoid *pixels); void glTexParameterf (GLenum target, GLenum pname, GLfloat param); void glTexParameteri (GLenum target, GLenum pname, GLint param); void glTranslatef (GLfloat x, GLfloat y, GLfloat z); void glVertex2f (GLfloat x, GLfloat y); void glVertex3f (GLfloat x, GLfloat y, GLfloat z); void glVertex4f (GLfloat x, GLfloat y, GLfloat z, GLfloat w); void glVertexPointer (GLint size, GLenum type, GLsizei stride, GLvoid *pointer); void glViewport (GLint x, GLint y, GLsizei width, GLsizei h); }
Feb 03 2003