www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - FreeType Binding

reply Trevor Parscal <trevorparscal hotmail.com> writes:
OK, So I spent hours and hours porting all 77 files, got a billion 
errors, worked on that for many hours, and decided to go the back way 
and implement ONLY the functions and definitions I needed to render 
basic text, and work from there.

So far this has been MUCH more successfully, spare the 4 or 5 structs 
that are referred to in the headers, but never defined (not in the 
source either).

HOWEVER, now that I have it compiling and all, I am trying to use it, 
and I get an error like this...

test.d(160): function freetype.FT_Init_FreeType (FT_LibraryRec_ **)
does not match argument types (FT_LibraryRec_ **)

I am statically linking a lib I compiled in MSVC.NET and converted with 
coff2omf, plus the lib from my binding of freetype I wrote in D.

I have tried C and Windows linkage. Nothing seems to work.

I attached a copy of my simplified binding. There are commented out 
lines, which all had to be muted because they use one of the 4 or 5 
missing type definitions.

If anyone has any advice, or a clue why the compiler would tell me that 
the arguments don't match, and than show me they are identical types, 
PLEASE let me know.

Thanks in advance.

-- 
Thanks,
Trevor Parscal
www.trevorparscal.com
trevorparscal hotmail.com
Jun 03 2005
parent reply "Ben Hinkle" <ben.hinkle gmail.com> writes:
"Trevor Parscal" <trevorparscal hotmail.com> wrote in message 
news:d7qu93$1lg8$1 digitaldaemon.com...
 OK, So I spent hours and hours porting all 77 files, got a billion
 errors, worked on that for many hours, and decided to go the back way
 and implement ONLY the functions and definitions I needed to render
 basic text, and work from there.

 So far this has been MUCH more successfully, spare the 4 or 5 structs
 that are referred to in the headers, but never defined (not in the
 source either).

 HOWEVER, now that I have it compiling and all, I am trying to use it,
 and I get an error like this...

 test.d(160): function freetype.FT_Init_FreeType (FT_LibraryRec_ **)
 does not match argument types (FT_LibraryRec_ **)
note if you put the function declarations after the struct declarations in freetype.d it seems to work fine (at least in my tiny test). I put the functions at the very end. This may be a bug with forward declarations.
Jun 03 2005
next sibling parent reply Trevor Parscal <trevorparscal hotmail.com> writes:
Ben Hinkle wrote:

 note if you put the function declarations after the struct declarations in 
 freetype.d it seems to work fine (at least in my tiny test). I put the 
 functions at the very end.
 This may be a bug with forward declarations. 
It worked.. thanks. Ben Hinkle = my hero... Forward Reference Bug = my enemy -- Thanks, Trevor Parscal www.trevorparscal.com trevorparscal hotmail.com
Jun 03 2005
next sibling parent reply Trevor Parscal <trevorparscal hotmail.com> writes:
Well, now I am facing this...

Libraries\FreeType.lib(ftinit)
  Error 42: Symbol Undefined __RTC_CheckEsp
Libraries\FreeType.lib(winfnt)
  Error 42: Symbol Undefined  _RTC_CheckStackVars 8
Libraries\FreeType.lib(pshinter)
  Error 42: Symbol Undefined __RTC_UninitUse
Libraries\FreeType.lib(psmodule)
  Error 42: Symbol Undefined ___security_cookie
Libraries\FreeType.lib(psmodule)
  Error 42: Symbol Undefined  __security_check_cookie 4

OK, so if I compiled the lib with MSVC.NET, and converted it with 
(Digital Mars) coff2omf, why is it mising these sybmols?

Any ideas of other ways to get this working? Experiences with MSVC.NET 
incompatibility?

-- 
Thanks,
Trevor Parscal
www.trevorparscal.com
trevorparscal hotmail.com
Jun 03 2005
parent reply Trevor Parscal <trevorparscal hotmail.com> writes:
I guess I am just flooding this group today.. Sorry..

Anyhoo, I am using a NON microsoft compiled lib now, which doesn't freak 
out like that one did...

and here is my new problem..

Source\Terra\Primitives\Drawing\Composite.obj(Composite)
  Error 42: Symbol Undefined _FT_Init_FreeType
Source\Terra\Primitives\Drawing\Composite.obj(Composite)
  Error 42: Symbol Undefined _FT_Done_FreeType

Is there something i don't know about making a static lib? should I be 
making a .def file for these functions? They are defined in the 
freetype.d file which I compiled to a lib..

-- 
Thanks,
Trevor Parscal
www.trevorparscal.com
trevorparscal hotmail.com
Jun 03 2005
parent "Ben Hinkle" <ben.hinkle gmail.com> writes:
"Trevor Parscal" <trevorparscal hotmail.com> wrote in message 
news:d7r37e$1olh$1 digitaldaemon.com...
I guess I am just flooding this group today.. Sorry..

 Anyhoo, I am using a NON microsoft compiled lib now, which doesn't freak 
 out like that one did...

 and here is my new problem..

 Source\Terra\Primitives\Drawing\Composite.obj(Composite)
  Error 42: Symbol Undefined _FT_Init_FreeType
 Source\Terra\Primitives\Drawing\Composite.obj(Composite)
  Error 42: Symbol Undefined _FT_Done_FreeType

 Is there something i don't know about making a static lib? should I be 
 making a .def file for these functions? They are defined in the freetype.d 
 file which I compiled to a lib..

 -- 
 Thanks,
 Trevor Parscal
 www.trevorparscal.com
 trevorparscal hotmail.com
The freetype.d file just has the extern(C) void foo() declarations, correct? You need to link in the actual implementations. I'm confused when you say "they are defined in freetype.d which I compiled to a lib" about which libs you're referring to. You shouldn't compile freetype.d into a lib - you should compile the c code that contains the implementations into a lib.
Jun 03 2005
prev sibling parent "Ben Hinkle" <ben.hinkle gmail.com> writes:
"Trevor Parscal" <trevorparscal hotmail.com> wrote in message 
news:d7r1hv$1nhp$1 digitaldaemon.com...
 Ben Hinkle wrote:

 note if you put the function declarations after the struct declarations 
 in freetype.d it seems to work fine (at least in my tiny test). I put the 
 functions at the very end.
 This may be a bug with forward declarations.
It worked.. thanks. Ben Hinkle = my hero... Forward Reference Bug = my enemy -- Thanks, Trevor Parscal www.trevorparscal.com trevorparscal hotmail.com
Narrowing down the shortest reproduction steps and posting to the bugs newsgroup will help Walter squash these things. I think many people here have been bitten by odd things like this enough that one develops the ability to smell forward-reference-bugs from 50 yards.
Jun 03 2005
prev sibling parent reply clayasaurus <clayasaurus gmail.com> writes:
Ben Hinkle wrote:
 "Trevor Parscal" <trevorparscal hotmail.com> wrote in message 
 news:d7qu93$1lg8$1 digitaldaemon.com...
 
OK, So I spent hours and hours porting all 77 files, got a billion
errors, worked on that for many hours, and decided to go the back way
and implement ONLY the functions and definitions I needed to render
basic text, and work from there.

So far this has been MUCH more successfully, spare the 4 or 5 structs
that are referred to in the headers, but never defined (not in the
source either).

HOWEVER, now that I have it compiling and all, I am trying to use it,
and I get an error like this...

test.d(160): function freetype.FT_Init_FreeType (FT_LibraryRec_ **)
does not match argument types (FT_LibraryRec_ **)
note if you put the function declarations after the struct declarations in freetype.d it seems to work fine (at least in my tiny test). I put the functions at the very end. This may be a bug with forward declarations.
on linux it compiled without any changes using 'dmd -c freetype.d'.
Jun 03 2005
parent Trevor Parscal <trevorparscal hotmail.com> writes:
clayasaurus wrote:
 Ben Hinkle wrote:
 
 "Trevor Parscal" <trevorparscal hotmail.com> wrote in message 
 news:d7qu93$1lg8$1 digitaldaemon.com...

 OK, So I spent hours and hours porting all 77 files, got a billion
 errors, worked on that for many hours, and decided to go the back way
 and implement ONLY the functions and definitions I needed to render
 basic text, and work from there.

 So far this has been MUCH more successfully, spare the 4 or 5 structs
 that are referred to in the headers, but never defined (not in the
 source either).

 HOWEVER, now that I have it compiling and all, I am trying to use it,
 and I get an error like this...

 test.d(160): function freetype.FT_Init_FreeType (FT_LibraryRec_ **)
 does not match argument types (FT_LibraryRec_ **)
note if you put the function declarations after the struct declarations in freetype.d it seems to work fine (at least in my tiny test). I put the functions at the very end. This may be a bug with forward declarations.
on linux it compiled without any changes using 'dmd -c freetype.d'.
Compiling the lib is no problem. Using it causes the problem.. :) -- Thanks, Trevor Parscal www.trevorparscal.com trevorparscal hotmail.com
Jun 03 2005