FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

HowTo: link to c code?
Goto page Previous  1, 2
 
Post new topic   Reply to topic     Forum Index -> General
View previous topic :: View next topic  
Author Message
JJR



Joined: 22 Feb 2004
Posts: 1104

PostPosted: Fri Oct 15, 2004 3:51 pm    Post subject: Reply with quote

jcc7 wrote:
Seems like there should be an easier way, but .def files usually work for me and my others attempts tend to fail. So I return to .def's even though they seem messy and unnecessary.


That's currently the only way so far as I know. I'm thinking it would almost be worth it to create a tool that automates the process, something Jan's implib was supposed to do.

jcc7 wrote:
Right. I don't even remember where .def that I pasted into the topic originated. I was trying to explain how to use the linker error message to solve the problem with a .def file. I've used various tricks to write .def files, but they're all kind of hacky. I don't know the best way to find all of the definitions, so if the linker complains about another one, I just add it when I find it.


Understandable. That method works. In order to get the complete list of function definitions, I had to resort to some "hackish" methods as well. Primarily I depend on the lcc version of the libs to get the necessary information. Besides Dmc, lcc appears to be the only distribution that makes use of the @# symbols postfix within its libraries.

It goes something like this:

1) Search the lcc distribution \lib directory for glu32.lib and opengl32.lib

2) Use the Openwatcom lib.exe to extract a .lst file from the library. I've tried dmc's and Borland's lib to do this, but haven't been successful. The lst file contains the full list of functions stored in the library WITH the appropriate @ symbols appended.

3) Use impdef.exe from the borland toolkit to get the basic .def file from the opengl32.dll and glu32.dll libs in the XP system directory.

4) Modify this .def file with the appropriate @ symbols as listed in the generated .lst file (by hand). This process could be easily automated with a program that parses the .lst file to add the appropriate @ symbols to functions in the .def file.

5) Apply Borland's or dmc's implib.exe on the resulting .def file to produce the appropriate .lib file (a complete opengl32.lib or glu32.lib). I've had various amounts of success with dmc's implib. Sometimes it doesn't work reliablely. Borland's seems to work fine here. To get it to work with dmc's implib, you also have to remove the "dll" from the name in the .def file's LIBRARY section.

The lib file that results works great. I wish there were a simpler way, but I just haven't discovered such.

jcc7 wrote:
Maybe we should put the best .def files in the SVN for the Bindings project or something like that.


I completely agree. I have a full opengl32.def and glu32.def to start with. These can be easily coverted to complete import libs as a described above or just linked into projects as is (conversion is then done internally by the linker, I guess). This is really a dmd specific problem due to it's relationship to dmc. I doubt gdc would have any issues of the same sort, but I don't know if a mingw or cygwin version of gdc has been compiled yet.

Later,

John
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> General All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group