NO

Author Topic: bgd.dll  (Read 4812 times)

czerny

  • Guest
bgd.dll
« on: May 14, 2013, 04:21:55 PM »
I am trying to make a working import library for 'bgd.dll', a precompiled version of the gd-library.

In the following I have reduced the output to two typical functions to reduce the material.

Code: [Select]
>podump /EXPORTS bgd.dll

Dump of bgd.dll

File type: DLL

        Exported symbols for bgd.dll

               0 characteristics
        41896739 time date stamp (Thu Nov  4 00:18:17 2004)
            0.00 version
               1 ordinal base
              8A number of functions
              8A number of names

        ordinal  hint  address   name
              A     9  6D8952B4  gdFontGetTiny@0
              B     A  6D93E75C  gdFontGiant

SUMMARY
   11000 .bss
   20000 .data
    2000 .edata
    1000 .idata
    6000 .reloc
   EB000 .stab
   F1000 .stabstr
   B5000 .text

There seems to me cdecl functions (gdFontGiant) and stdcall functions (gdFontGetTiny) in this dll.

Code: [Select]
polib bgd.dll /MACHINE:X86 /makedef:bgd.def

POLIB: fatal error: Corrupt library: 'bgd.dll'.

This command does not work as expected!
So I first made an import library with:

Code: [Select]
polib bgd.dll /MACHINE:X86 /out:bgd.lib

and afterwards

Code: [Select]
polib bgd.dll /MACHINE:X86 /makedef:bgd.def /out:bgd.lib

which produced

Code: [Select]
LIBRARY "bgd.dll"
EXPORTS
"gdFontGetTiny@0" ; bgd.dll
"_gdFontGiant" DATA ; bgd.dll

than I in got

Code: [Select]
podump /IMPORTS bgd.lib

Dump of bgd.lib

File type: LIB
bgd.dll: gdFontGetTiny@0 (gdFontGetTiny@0)
bgd.dll: gdFontGiant (_gdFontGiant)

SUMMARY
      14 .idata$2
      14 .idata$3
       4 .idata$4
       4 .idata$5
       8 .idata$6

all this looks a little inconsistent to me. And it does not work

Code: [Select]
POLINK: error: Unresolved external symbol '_gdImageCreateTrueColor@8'.

I tryed all variants of PeExp2Def

Code: [Select]
(function)
LIBRARY bgd.dll
EXPORTS
gdFontGetTiny@0
gdFontGiant

("function")
LIBRARY bgd.dll
EXPORTS
"gdFontGetTiny@0"
"gdFontGiant"

(function = function@x)
LIBRARY bgd.dll
EXPORTS
gdFontGetTiny = gdFontGetTiny@0
gdFontGiant

(function@x ordinal)
LIBRARY bgd.dll
EXPORTS
gdFontGetTiny@0 @10
gdFontGiant @11

But that does not work too.

What I am doing wrong?

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2096
Re: bgd.dll
« Reply #1 on: May 14, 2013, 07:29:19 PM »
gdFontGetTiny@0 -> __stdcall decorated name takes zero arguments (0 bytes)
"_gdFontGiant     -> __cdecl.

I'm not sure that you can use that library if you don't have a full header.
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: bgd.dll
« Reply #2 on: May 14, 2013, 07:34:48 PM »
What I am doing wrong?
That dll seems to be for MinGW.
gdImageCreate@8 isn't normal __stdcall function name in win32,  _gdImageCreate@8 or gdImageCreate is for win32.
_gdFontGiant is for data.
__declspec(dllimport) in header also means to use gdImageCreate

EDIT: some bgd.dll depends too much msvcrt.dll, so it can be useless with PellesC (different FILE struct?).
« Last Edit: May 15, 2013, 03:24:10 PM by timovjl »
May the source be with you

czerny

  • Guest
Re: bgd.dll
« Reply #3 on: May 14, 2013, 07:41:01 PM »
I'm not sure that you can use that library if you don't have a full header.
I have the header files. Problem is to create a working import library.

czerny

  • Guest
Re: bgd.dll
« Reply #4 on: May 14, 2013, 09:53:59 PM »
with a def file

Code: [Select]
_func@x = func@x

the code compiles. But than 'func' (not 'func@x') is searched for and not found.