Recent

Author Topic: How to use C library?  (Read 5230 times)

ertank

  • Sr. Member
  • ****
  • Posts: 274
How to use C library?
« on: April 08, 2016, 05:43:13 pm »
Hi,

I have a WinCE device and an ARMV4 SDK for that device. However, I am provided a C library and header files only. I have not enough C knowledge to make a wrapper DLL for that library.

Is there a way for me to be able to use it in my EXE? Or, is it possible to make a wrapper DLL with some basic instructions?

Thanks.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: How to use C library?
« Reply #1 on: April 09, 2016, 05:40:05 am »
Is there a way for me to be able to use it in my EXE? Or, is it possible to make a wrapper DLL with some basic instructions?
Yes, learn how to make the wrapper. It's no way basic, but not complex nor advanced either. I suggest not to use h2pas in the first place, but learn how to read C instead. Only after that you can use h2pas. There's no guarantee that h2pas can generate directly usable wrapper, some things are just too hard to create a wrapper for automatically. In fact, there are already cases where initially written by h2pas wrapper is totally rewritten by hand.

Thaddy

  • Hero Member
  • *****
  • Posts: 14359
  • Sensorship about opinions does not belong here.
Re: How to use C library?
« Reply #2 on: April 09, 2016, 11:15:47 am »
In fact, there are already cases where initially written by h2pas wrapper is totally rewritten by hand.

That's mostly because such a user has no clue where its for and how it works.
Rule number one is to first run a c preprossesor to expand any C macro's to actual plain C and only after that run h2pas and h2paspp.
Running the C preprocessor means also pulling in all C header files except maybe the standard ones.
After that I almost always have excellent results with h2pas.

Notable crime that doesn't work: K&R style parameters with type only, like (int,int,long void*) // valid C but....


AAlso note all but some wince standard headers are already translated, of course.
« Last Edit: April 09, 2016, 11:28:37 am by Thaddy »
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

 

TinyPortal © 2005-2018