www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - help with windows .lib and .dll

reply Ant <duitoolkit yahoo.ca> writes:
I still don't know about .lib and .dll on windows.

I know how to use implib to create a .lib from a .dll.

for the windows version of leds I asked on the scintilla
group for a compiled scintilla lib "Gtk+ mode" for windows,
and Mr. Iago Rubio was able to give me one.
http://mailman.lyra.org/pipermail/scintilla-interest/2004-December/005268.html

now what I have is a scintilla.lib and the DM linker
complains: "Error 43: Not a Valid Library File" (message typed in)

can I convert that scintilla.lib?
can I use it in a different way?

or do I need to ask again? if so what should I be asking for?

thanks,

Ant
Dec 17 2004
parent reply John Reimer <brk_6502 yahoo.com> writes:
Ant wrote:
 I still don't know about .lib and .dll on windows.
 
 I know how to use implib to create a .lib from a .dll.
 
 for the windows version of leds I asked on the scintilla
 group for a compiled scintilla lib "Gtk+ mode" for windows,
 and Mr. Iago Rubio was able to give me one.
 http://mailman.lyra.org/pipermail/scintilla-interest/2004-December/005268.html
 
 now what I have is a scintilla.lib and the DM linker
 complains: "Error 43: Not a Valid Library File" (message typed in)
 
 can I convert that scintilla.lib?
 can I use it in a different way?
 
 or do I need to ask again? if so what should I be asking for?
 
 thanks,
 
 Ant
 

Ant, This is a huge, nasty affair; it's a topic that comes up over and over again with the dmc and dmd compilers because they don't work well with anything Microsoft compiled (read: COFF object format). Successful use of scinitilla.lib is only guaranteed if you have compiled that library with the Digitalmars C/C++ compiler. Otherwise it's a complicated game - rarely successful - of trying to dig up tools that can convert the *.lib format to the necessary OMF format that dmd understands. I've discussed the possibilities so often now that I tire of expressing them again -- not so much because the conversion methods are useless; it's just that in the long run they appear to be a waste of time and energy, the chance of success being too unpredictable or unreliable. So now I just prefer dynamic (or runtime) function loading to solve the world's problems on Windows... That is the only other method that seems to work, and the library must be compiled as a dll first. Then, which compiler brand was used to make the library doesn't seem to be an issue. You just use the Win32 LoadLibrary() and GetProcAddress() calls to get the functions you need. I think I've mentioned this to you in a related topic in a personal email. :-) So the question first is... Have you been able to get scintilla.lib compiled with the dmc compiler (If you want to directly link with scintilla)? If no, the next question is... Is it possible to compile scintilla into a dll (with any compiler)? Later, John
Dec 17 2004
next sibling parent Ant <duitoolkit yahoo.ca> writes:
On Fri, 17 Dec 2004 23:22:46 -0800, John Reimer wrote:

 So the question first is... Have you been able to get scintilla.lib 
 compiled with the dmc compiler (If you want to directly link with 
 scintilla)?
 
 If no, the next question is...  Is it possible to compile scintilla into 
 a dll (with any compiler)?
 

I just have to ask th guy again... :( thanks, Ant
Dec 18 2004
prev sibling next sibling parent reply Ant <duitoolkit yahoo.ca> writes:
On Fri, 17 Dec 2004 23:22:46 -0800, John Reimer wrote:

 Ant wrote:
 I still don't know about .lib and .dll on windows.
 

This is a huge, nasty affair;

what about linking with the Visual C++ toolkit? will it recognise the .obj from DMD? Ant
Dec 18 2004
next sibling parent John Reimer <brk_6502 yahoo.com> writes:
Ant wrote:
 On Fri, 17 Dec 2004 23:22:46 -0800, John Reimer wrote:
 
 
Ant wrote:

I still don't know about .lib and .dll on windows.

This is a huge, nasty affair;

what about linking with the Visual C++ toolkit? will it recognise the .obj from DMD? Ant

Hmmm... You mean using the Visual C++ linker to link a dmd OMF object file with the MS C COFF library? I'm not sure. It depends on whether the linker supports the old OMF format. You could try, but I've never tried that before. Another linker that DOES support both COFF and OMF formats and supposedly knows how to link these together is the Openwatcom linker. I've made limited and unsuccessful attempts at using it. My lack of success was probably more due not knowing how to operate the openwatcom linker on dmd files than anything else. But that's where more headaches come in to play: when using unproven tools. Sometimes it's just easier to try recompiling the whole library with the Digitalmars c/c++ compiler. Look at Christof Meerwald's site for these tools (designed to work with dmc): http://cmeerw.org/prog/owtools/ I hope you are more successful then I am. Tell me how it goes. Like I said, it gets complicated fast when you venture into new territory. - John
Dec 18 2004
prev sibling parent "Carlos Santander B." <csantander619 gmail.com> writes:
"Ant" <duitoolkit yahoo.ca> escribió en el mensaje
news:pan.2004.12.18.18.42.12.589061 yahoo.ca...
| On Fri, 17 Dec 2004 23:22:46 -0800, John Reimer wrote:
|
| what about linking with the Visual C++ toolkit?
| will it recognise the .obj from DMD?
|
| Ant
|

Besides John's suggestion (which I think will work), I have a couple more:

1. Do what you said: link with VC++. It produces a warning but recognizes DMD's
OMF (amazingly it doesn't recognize Borland's. Neither does Christof's wlink).
2. (my preferred way) Convert the .lib to the old COFF format and then use DMD's
coff2omf to get a DMD compatible library. This would be:
1. [with MS tools]
lib /convert scintilla.lib
2. [with DM tools]
coff2omf scintilla.lib

-----------------------
Carlos Santander Bernal
Dec 18 2004
prev sibling parent reply Ant <duitoolkit yahoo.ca> writes:
On Fri, 17 Dec 2004 23:22:46 -0800, John Reimer wrote:

 
 If no, the next question is...  Is it possible to compile scintilla into 
 a dll (with any compiler)?

yes, I got the DLL. I'm off for two weeks. I'll try it next year. Ant
Dec 19 2004
parent John Reimer <brk_6502 yahoo.com> writes:
Ant wrote:
 On Fri, 17 Dec 2004 23:22:46 -0800, John Reimer wrote:
 
 
If no, the next question is...  Is it possible to compile scintilla into 
a dll (with any compiler)?

yes, I got the DLL. I'm off for two weeks. I'll try it next year. Ant

I hope your holidays goe well, Ant. Have a great new year. - John
Dec 19 2004