[fpc-pascal] Re: PDFlib TET - convert using h2pas
Ludo Brands
ludo.brands at free.fr
Wed May 18 18:28:52 CEST 2011
>From your question COM or header, I assumed you are only interested in
windows. I also assume that you don't want to export functions defiend. So,
I did the following:
- removed PDFLIB_API and PDFLIB_CALL (point 1 in my previous message)
- replaced the L".." defines by one to the char version (point 2)
The result from h2pas is attached. What needs to be done:
- add stdcall; behind all functions that had PDFLIB_API. Both in interface
and implementation part.
- if you are linking dynamically replace in the functions that had
PDFLIB_CALL in the implementation part
begin
{ You must implement this function }
end;
with
external 'name of the lib';
- as always, review the translation
Ludo
-----Message d'origine-----
De : fpc-pascal-bounces at lists.freepascal.org
[mailto:fpc-pascal-bounces at lists.freepascal.org] De la part de Ludo Brands
Envoyé : mercredi 18 mai 2011 16:51
À : 'FPC-Pascal users discussions'
Objet : RE : [fpc-pascal] Re: PDFlib TET - convert using h2pas
In this case:
1) because h2pas doesn't use pascal macro's. A construct like #if
defined(WIN32) && !defined(PDFLIB_CALL)
#define PDFLIB_CALL __cdecl
#endif
can not be translated using pascal constants or functions. Cdecl is a
calling convention modifier.
2) afaik pascal doesnt support widestring constants. Therefor h2pas doesn't
understand
#define IFILTER_WCHAR_LONG_VERSIONSTRING L"4.0p7". In this case, the
string doesn't contain non-ascii characters and pascal will assign (convert)
correctly a ascii string to a widechar string. So you can just solve the
problem by
const IFILTER_WCHAR_LONG_VERSIONSTRING=IFILTER_LONG_VERSIONSTRING;
Ludo
-----Message d'origine-----
De : fpc-pascal-bounces at lists.freepascal.org
[mailto:fpc-pascal-bounces at lists.freepascal.org] De la part de Marcos
Douglas Envoyé : mercredi 18 mai 2011 16:24 À : FPC-Pascal users discussions
Objet : [fpc-pascal] Re: PDFlib TET - convert using h2pas
On Tue, May 17, 2011 at 5:04 PM, Marcos Douglas <md at delfire.net> wrote:
>
> Hi,
> I would like to use the TET[1] in FPC on Windows.
> There are 2 options:
> 1- Translate C header to use libtet.dll (I prefer);
> 2- Use the COM object (TET_com.dll);
>
> I can use COM in Delphi 7 easily. There is a Wizard to translate call
> from COM object to Object Pascal... But I would like to use FPC!
>
> Somebody can help me to use h2pas tool to translate the C header in
> attachment?
>
> [1] http://www.pdflib.com/download/tet/
Anyone?
At least tell me why h2pas can not parse this header file, please.
Marcos Douglas
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-pascal at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tetlib.pp
Type: application/octet-stream
Size: 29627 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20110518/875caf92/attachment.obj>
More information about the fpc-pascal
mailing list