Re: [fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows

2017-03-14 Thread silvioprog
On Tue, Mar 14, 2017 at 12:39 PM, silvioprog  wrote:

> On Tue, Mar 14, 2017 at 12:26 PM, LacaK  wrote:
>
>> Dňa 14.3.2017 o 15:57 silvioprog napísal(a):
>
> [...]
>
>> here I get (without {$linklib}):
>>   Error: Undefined symbol: IPP__IPPITHRESHOLD_LTVAL_8U_C1
>> IR$PIPP8U$LONGINT$IPPISIZE$BYTE$BYTE$$IPPSTATUS
>>
>> test 2: put the library implementation below function declaration, eg:
>>>
>>> function _ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u; srcDstStep:
>>> int;
>>>roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u;
>>> thresholdGT: Ipp8u;
>>>valueGT: Ipp8u): IppStatus; external;
>>> {$linklib libippi}
>>>
>> here I get:
>>   Error: Undefined symbol: IPP__IPPITHRESHOLD_LTVAL_8U_C1
>> IR$PIPP8U$LONGINT$IPPISIZE$BYTE$BYTE$$IPPSTATUS
>> (same error if I add: {$linklib ippi} or {$linklib libippi} ... ippi.lib
>> and libippi.a are in directory where -Fl points)
>
>
>>> fix 1: check which convention your library was compiled,
>>>
>> I think it is stdcall and I have this calling convention there (extdecl
>> is macro: {$DEFINE extdecl:=stdcall}  ):
>>   function _ippiThreshold_LTVal_8u_C1IR(pSrcDst: PIpp8u;srcDstStep:
>> int;  roiSize: IppiSize; threshold: Ipp8u; value: Ipp8u): IppStatus;
>>extdecl; external;
>
>
> Awesome. Now we need to check how libippi had exported its symbols. :-)
> For example, to check the symbols from the libfoo.a sent in my previous
> message:
>
> $ objdump -t libfoo.a
> In archive libfoo.a:
>
> libfoo.o: file format pe-i386
>
> SYMBOL TABLE:
> [  0](sec -2)(fl 0x00)(ty   0)(scl 103) (nx 1) 0x foo.c
> File
> *[  2](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 1) 0x _bar*
> AUX tagndx 0 ttlsiz 0x0 lnnos 0 next 0
> [  4](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x .text
> AUX scnlen 0xa nreloc 1 nlnno 0
> [  6](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x .data
> AUX scnlen 0x0 nreloc 0 nlnno 0
> [  8](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x .bss
> AUX scnlen 0x0 nreloc 0 nlnno 0
> [ 10](sec  4)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x .rdata
> AUX scnlen 0x4 nreloc 0 nlnno 0
> [ 12](sec  5)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x .rdata$zzz
> AUX scnlen 0x2a nreloc 0 nlnno 0
> [ 14](sec  6)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x .eh_frame
> AUX scnlen 0x38 nreloc 1 nlnno 0
>
> Notice the _bar, now you need to check if libippi exported it as
> ippithreshold_ltvalgtval_8u_c1ir, _ippithreshold_ltvalgtval_8u_c1ir or
> ipp__ippithreshold_ltval_8u_c1ir. :-)
>

I forgot a question, could you send your ippi .a files for us? If so, I can
try a test here. :-)

-- 
Silvio Clécio
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows

2017-03-14 Thread silvioprog
On Tue, Mar 14, 2017 at 12:26 PM, LacaK  wrote:

> Dňa 14.3.2017 o 15:57 silvioprog napísal(a):

[...]

> here I get (without {$linklib}):
>   Error: Undefined symbol: IPP__IPPITHRESHOLD_LTVAL_8U_C1
> IR$PIPP8U$LONGINT$IPPISIZE$BYTE$BYTE$$IPPSTATUS
>
> test 2: put the library implementation below function declaration, eg:
>>
>> function _ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u; srcDstStep:
>> int;
>>roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u;
>> thresholdGT: Ipp8u;
>>valueGT: Ipp8u): IppStatus; external;
>> {$linklib libippi}
>>
> here I get:
>   Error: Undefined symbol: IPP__IPPITHRESHOLD_LTVAL_8U_C1
> IR$PIPP8U$LONGINT$IPPISIZE$BYTE$BYTE$$IPPSTATUS
> (same error if I add: {$linklib ippi} or {$linklib libippi} ... ippi.lib
> and libippi.a are in directory where -Fl points)


>> fix 1: check which convention your library was compiled,
>>
> I think it is stdcall and I have this calling convention there (extdecl is
> macro: {$DEFINE extdecl:=stdcall}  ):
>   function _ippiThreshold_LTVal_8u_C1IR(pSrcDst: PIpp8u;srcDstStep: int;
> roiSize: IppiSize; threshold: Ipp8u; value: Ipp8u): IppStatus;
>extdecl; external;


Awesome. Now we need to check how libippi had exported its symbols. :-) For
example, to check the symbols from the libfoo.a sent in my previous message:

$ objdump -t libfoo.a
In archive libfoo.a:

libfoo.o: file format pe-i386

SYMBOL TABLE:
[  0](sec -2)(fl 0x00)(ty   0)(scl 103) (nx 1) 0x foo.c
File
*[  2](sec  1)(fl 0x00)(ty  20)(scl   2) (nx 1) 0x _bar*
AUX tagndx 0 ttlsiz 0x0 lnnos 0 next 0
[  4](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x .text
AUX scnlen 0xa nreloc 1 nlnno 0
[  6](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x .data
AUX scnlen 0x0 nreloc 0 nlnno 0
[  8](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x .bss
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 10](sec  4)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x .rdata
AUX scnlen 0x4 nreloc 0 nlnno 0
[ 12](sec  5)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x .rdata$zzz
AUX scnlen 0x2a nreloc 0 nlnno 0
[ 14](sec  6)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x .eh_frame
AUX scnlen 0x38 nreloc 1 nlnno 0

Notice the _bar, now you need to check if libippi exported it as
ippithreshold_ltvalgtval_8u_c1ir, _ippithreshold_ltvalgtval_8u_c1ir or
ipp__ippithreshold_ltval_8u_c1ir. :-)

--
Silvio Clécio
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows

2017-03-14 Thread LacaK

Dňa 14.3.2017 o 15:57 silvioprog napísal(a):
On Tue, Mar 14, 2017 at 9:30 AM, LacaK > wrote:


Hi,

I have C/C++ librarby (".lib" for Windows and ".a" for Linux) from
Intel IPP package (they distribute ".lib" and also ".dll" for
Windows and ".a" for Linux)

Can I link in FPC (on Windows) at compile time to this ".lib"
versions ? Or only possible way is link at runtime using ".dll"
(and distribute DLLs with my EXE)?
(I guess, that FPC can not link to libraries not created in FPC
itself. So format of supplied ".lib" is not compatible with what
FPC expects)

I am trying do something like:
{$linklib libippi}
function ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u;
srcDstStep: int;
   roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u;
thresholdGT: Ipp8u;
   valueGT: Ipp8u): IppStatus; external; // 'ippi.dll';

(In Project Options I have path to libippi.a in -Fl)

But I get error: test_IPP.lpr(24,1) Error: Undefined symbol:

IPP_IPPITHRESHOLD_LTVALGTVAL_8U_C1IR$PIPP8U$LONGINT$IPPISIZE$BYTE$BYTE$BYTE$BYTE$$IPPSTATUS


test 1: are you on win32? If so, did you try using prefix "_"? eg:

function _ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u; 
srcDstStep: int;
   roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u; 
thresholdGT: Ipp8u;

   valueGT: Ipp8u): IppStatus; external;


here I get (without {$linklib}):
  Error: Undefined symbol: 
IPP__IPPITHRESHOLD_LTVAL_8U_C1IR$PIPP8U$LONGINT$IPPISIZE$BYTE$BYTE$$IPPSTATUS



test 2: put the library implementation below function declaration, eg:

function _ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u; 
srcDstStep: int;
   roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u; 
thresholdGT: Ipp8u;

   valueGT: Ipp8u): IppStatus; external;
{$linklib libippi}

here I get:
  Error: Undefined symbol: 
IPP__IPPITHRESHOLD_LTVAL_8U_C1IR$PIPP8U$LONGINT$IPPISIZE$BYTE$BYTE$$IPPSTATUS
(same error if I add: {$linklib ippi} or {$linklib libippi} ... ippi.lib 
and libippi.a are in directory where -Fl points)




fix 1: check which convention your library was compiled,
I think it is stdcall and I have this calling convention there (extdecl 
is macro: {$DEFINE extdecl:=stdcall}  ):
  function _ippiThreshold_LTVal_8u_C1IR(pSrcDst: PIpp8u;srcDstStep: 
int;  roiSize: IppiSize; threshold: Ipp8u; value: Ipp8u): IppStatus;

   extdecl; external;

-Laco.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows

2017-03-14 Thread Adriaan van Os

LacaK wrote:

Hi,

I have C/C++ librarby (".lib" for Windows and ".a" for Linux) from Intel 
IPP package (they distribute ".lib" and also ".dll" for Windows and ".a" 
for Linux)


Note that you can download my ipp FPC interfaces here . I do 
link with statically with success on Mac OS X.


Regards,

Adriaan van Os

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows

2017-03-14 Thread silvioprog
On Tue, Mar 14, 2017 at 11:29 AM, silvioprog  wrote:

> On Tue, Mar 14, 2017 at 10:36 AM, Sven Barth via fpc-devel <
> fpc-devel@lists.freepascal.org> wrote:
> [...]
>
>> Small correction: I meant "static COFF libraries", not "COFF import
>> libraries" (the later can be considered a special case of the former
>> though).
>>
> Is there any plan to support COFF object on Windows? I've used it fine on
> Linux ({$l blah.a}), but on Windows it breaks the compilation with "illegal
> coff magic while reading blah".
>

Please ignore my question. :-D

I have fpc 3 and trunk in same machine, now after testing in trunk version
it work like a charm. ^^'

-- 
Silvio Clécio
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows

2017-03-14 Thread silvioprog
On Tue, Mar 14, 2017 at 11:57 AM, silvioprog  wrote:
[...]

> Anyway I've tried to use COFF objects on Windows, but I'm not sure if FPC
> supports that because it returns a "illegal COFF magic while reading some
> lib". :-/ (on Linux it works like a charm)
>

Oh, sorry. It works on Windows too. I've used the wrong compiler version,
because I have fpc 3 and trunk in same machine. ^^' I'm going to share the
steps I've done ...

-- 
Silvio Clécio
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows

2017-03-14 Thread silvioprog
On Tue, Mar 14, 2017 at 9:30 AM, LacaK  wrote:

> Hi,
>
> I have C/C++ librarby (".lib" for Windows and ".a" for Linux) from Intel
> IPP package (they distribute ".lib" and also ".dll" for Windows and ".a"
> for Linux)
>
> Can I link in FPC (on Windows) at compile time to this ".lib" versions ?
> Or only possible way is link at runtime using ".dll" (and distribute DLLs
> with my EXE)?
> (I guess, that FPC can not link to libraries not created in FPC itself. So
> format of supplied ".lib" is not compatible with what FPC expects)
>
> I am trying do something like:
> {$linklib libippi}
> function ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u; srcDstStep:
> int;
>roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u; thresholdGT:
> Ipp8u;
>valueGT: Ipp8u): IppStatus; external; // 'ippi.dll';
>
> (In Project Options I have path to libippi.a in -Fl)
>
> But I get error: test_IPP.lpr(24,1) Error: Undefined symbol:
> IPP_IPPITHRESHOLD_LTVALGTVAL_8U_C1IR$PIPP8U$LONGINT$IPPISIZE
> $BYTE$BYTE$BYTE$BYTE$$IPPSTATUS
>

test 1: are you on win32? If so, did you try using prefix "_"? eg:

function _ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u; srcDstStep: int;
   roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u; thresholdGT:
Ipp8u;
   valueGT: Ipp8u): IppStatus; external;

test 2: put the library implementation below function declaration, eg:

function _ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u; srcDstStep: int;
   roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u; thresholdGT:
Ipp8u;
   valueGT: Ipp8u): IppStatus; external;
{$linklib libippi}

fix 1: check which convention your library was compiled, supposing it was
compiled supporting CDECL, you need to specify it on your Pascal binding,
avoiding low-level errors at runtime:

function _ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u; srcDstStep: int;
   roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u; thresholdGT:
Ipp8u;
   valueGT: Ipp8u): IppStatus; cdecl; external;

Anyway I've tried to use COFF objects on Windows, but I'm not sure if FPC
supports that because it returns a "illegal COFF magic while reading some
lib". :-/ (on Linux it works like a charm)


> I am doing something wrong or just this is not possible ?
>
> Thank you
> -Laco.


-- 
Silvio Clécio
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows

2017-03-14 Thread silvioprog
On Tue, Mar 14, 2017 at 10:36 AM, Sven Barth via fpc-devel <
fpc-devel@lists.freepascal.org> wrote:
[...]

> Small correction: I meant "static COFF libraries", not "COFF import
> libraries" (the later can be considered a special case of the former
> though).
>
Is there any plan to support COFF object on Windows? I've used it fine on
Linux ({$l blah.a}), but on Windows it breaks the compilation with "illegal
coff magic while reading blah".

--
Silvio Clécio
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows

2017-03-14 Thread Pierre Free Pascal


> -Message d'origine-
> De : fpc-devel [mailto:fpc-devel-boun...@lists.freepascal.org] De la
> part de LacaK
> Envoyé : mardi 14 mars 2017 13:30
> À : fpc-devel@lists.freepascal.org
> Objet : [fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal
> on Windows
> 
> Hi,
> 
> I have C/C++ librarby (".lib" for Windows and ".a" for Linux) from
> Intel
> IPP package (they distribute ".lib" and also ".dll" for Windows and
> ".a"
> for Linux)
> 
> Can I link in FPC (on Windows) at compile time to this ".lib" versions
> ?
> Or only possible way is link at runtime using ".dll" (and distribute
> DLLs with my EXE)?
> (I guess, that FPC can not link to libraries not created in FPC itself.
> So format of supplied ".lib" is not compatible with what FPC expects)
> 
> I am trying do something like:
> {$linklib libippi}
> function ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u; srcDstStep:
> int;
> roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u;
> thresholdGT: Ipp8u;
> valueGT: Ipp8u): IppStatus; external; // 'ippi.dll';


Did you try this:
 function ippiThreshold(pSrcDst: PIpp8u; srcDstStep: int;
 roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u; thresholdGT: 
Ipp8u;
 valueGT: Ipp8u): IppStatus; external 'ippi.dll' name 
'ippiThreshold_LTValGTVal_8u_C1IR';
You should use 
objdump -p ippi.dll
to get the names of the exported procedures/functions.

You could also test cppdecl; modifier for linux target,

In the hope it will help,

Pierre Muller
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows

2017-03-14 Thread Tomas Hajny
On Tue, March 14, 2017 14:36, Sven Barth via fpc-devel wrote:
> Am 14.03.2017 14:33 schrieb "Sven Barth" :
>> Am 14.03.2017 13:30 schrieb "LacaK" :
>> >
>> > Hi,
>> >
>> > I have C/C++ librarby (".lib" for Windows and ".a" for Linux) from
> Intel IPP package (they distribute ".lib" and also ".dll" for Windows and
> ".a" for Linux)
>> >
>> > Can I link in FPC (on Windows) at compile time to this ".lib" versions
> ? Or only possible way is link at runtime using ".dll" (and distribute
> DLLs
> with my EXE)?
>> > (I guess, that FPC can not link to libraries not created in FPC
>> itself.
> So format of supplied ".lib" is not compatible with what FPC expects)
>> >
>> > I am trying do something like:
>> > {$linklib libippi}
>> > function ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u; srcDstStep:
> int;
>> >roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u;
> thresholdGT: Ipp8u;
>> >valueGT: Ipp8u): IppStatus; external; // 'ippi.dll';
>> >
>> > (In Project Options I have path to libippi.a in -Fl)
>> >
>> > But I get error: test_IPP.lpr(24,1) Error: Undefined symbol:
> IPP_IPPITHRESHOLD_LTVALGTVAL_8U_C1IR$PIPP8U$LONGINT$IPPISIZE$BYTE$BYTE$BYTE$BYTE$$IPPSTATUS
>> >
>> > I am doing something wrong or just this is not possible ?
 .
 .

Doesn't the declaration above miss "cdecl;" or something similar (before
"external")? You could also use the 'name' modifier, I guess, to avoid FPC
symbol mangling (but cdecl should do it as well).

Apart from that - based on the name, I'd suspect that it's C++ rather than
C (linking to C++ isn't fully supported by FPC yet as far as I know)?

Tomas


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows

2017-03-14 Thread Sven Barth via fpc-devel
Am 14.03.2017 13:30 schrieb "LacaK" :
>
> Hi,
>
> I have C/C++ librarby (".lib" for Windows and ".a" for Linux) from Intel
IPP package (they distribute ".lib" and also ".dll" for Windows and ".a"
for Linux)
>
> Can I link in FPC (on Windows) at compile time to this ".lib" versions ?
Or only possible way is link at runtime using ".dll" (and distribute DLLs
with my EXE)?
> (I guess, that FPC can not link to libraries not created in FPC itself.
So format of supplied ".lib" is not compatible with what FPC expects)
>
> I am trying do something like:
> {$linklib libippi}
> function ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u; srcDstStep:
int;
>roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u;
thresholdGT: Ipp8u;
>valueGT: Ipp8u): IppStatus; external; // 'ippi.dll';
>
> (In Project Options I have path to libippi.a in -Fl)
>
> But I get error: test_IPP.lpr(24,1) Error: Undefined symbol:
IPP_IPPITHRESHOLD_LTVALGTVAL_8U_C1IR$PIPP8U$LONGINT$IPPISIZE$BYTE$BYTE$BYTE$BYTE$$IPPSTATUS
>
> I am doing something wrong or just this is not possible ?
>

You might want to try the external linker using -Xe. The internal linker
does not yet support COFF import libraries.

Regards,
Sven
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows

2017-03-14 Thread Sven Barth via fpc-devel
Am 14.03.2017 14:33 schrieb "Sven Barth" :
>
> Am 14.03.2017 13:30 schrieb "LacaK" :
> >
> > Hi,
> >
> > I have C/C++ librarby (".lib" for Windows and ".a" for Linux) from
Intel IPP package (they distribute ".lib" and also ".dll" for Windows and
".a" for Linux)
> >
> > Can I link in FPC (on Windows) at compile time to this ".lib" versions
? Or only possible way is link at runtime using ".dll" (and distribute DLLs
with my EXE)?
> > (I guess, that FPC can not link to libraries not created in FPC itself.
So format of supplied ".lib" is not compatible with what FPC expects)
> >
> > I am trying do something like:
> > {$linklib libippi}
> > function ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u; srcDstStep:
int;
> >roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u;
thresholdGT: Ipp8u;
> >valueGT: Ipp8u): IppStatus; external; // 'ippi.dll';
> >
> > (In Project Options I have path to libippi.a in -Fl)
> >
> > But I get error: test_IPP.lpr(24,1) Error: Undefined symbol:
IPP_IPPITHRESHOLD_LTVALGTVAL_8U_C1IR$PIPP8U$LONGINT$IPPISIZE$BYTE$BYTE$BYTE$BYTE$$IPPSTATUS
> >
> > I am doing something wrong or just this is not possible ?
> >
>
> You might want to try the external linker using -Xe. The internal linker
does not yet support COFF import libraries.

Small correction: I meant "static COFF libraries", not "COFF import
libraries" (the later can be considered a special case of the former
though).

Regards,
Sven
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] Staticaly link C/C++ library (.lib) into FreePascal on Windows

2017-03-14 Thread LacaK

Hi,

I have C/C++ librarby (".lib" for Windows and ".a" for Linux) from Intel 
IPP package (they distribute ".lib" and also ".dll" for Windows and ".a" 
for Linux)


Can I link in FPC (on Windows) at compile time to this ".lib" versions ? 
Or only possible way is link at runtime using ".dll" (and distribute 
DLLs with my EXE)?
(I guess, that FPC can not link to libraries not created in FPC itself. 
So format of supplied ".lib" is not compatible with what FPC expects)


I am trying do something like:
{$linklib libippi}
function ippiThreshold_LTValGTVal_8u_C1IR(pSrcDst: PIpp8u; srcDstStep: int;
   roiSize: IppiSize; thresholdLT: Ipp8u; valueLT: Ipp8u; 
thresholdGT: Ipp8u;

   valueGT: Ipp8u): IppStatus; external; // 'ippi.dll';

(In Project Options I have path to libippi.a in -Fl)

But I get error: test_IPP.lpr(24,1) Error: Undefined symbol: 
IPP_IPPITHRESHOLD_LTVALGTVAL_8U_C1IR$PIPP8U$LONGINT$IPPISIZE$BYTE$BYTE$BYTE$BYTE$$IPPSTATUS


I am doing something wrong or just this is not possible ?

Thank you
-Laco.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Math and numlib

2017-03-14 Thread Michael Van Canneyt



On Tue, 14 Mar 2017, Werner Pamler wrote:

Thanks - unfortunately I've just uploaded a patch for unit typ 
implementing IsNaN and IsInfinity according to Michael's suggestion. But 
I think I'll withdraw the patch and replace it with one for a cleaned up 
typ unit.


How about cleaning up also spe? It contains a large number of functions 
which are contained in math as well, but with a terrible name (e.g., 
"spesih(x)" instead of "sinh(x)"). In theory, of course, this will break 
existing code although I am absolutely sure that nobody ever has used 
these functions.


Another idea: Errors in spe (and probably everywhere else) terminate the 
program with a RunError. This is not up to date any more. How about 
throwing an exception? Or, maybe, I could add a procedure 
"NumLibError(ErrCode: Integer)" which by default throws an exception 
with a message corresponding to the ErrCode, or, if compiled with 
$DEFINE RUNTIME_ERRORS, terminates the program like before with a 
RunError(ErrCode).


Better make this a normal variable; not a define.

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Math and numlib

2017-03-14 Thread Werner Pamler
Thanks - unfortunately I've just uploaded a patch for unit typ 
implementing IsNaN and IsInfinity according to Michael's suggestion. But 
I think I'll withdraw the patch and replace it with one for a cleaned up 
typ unit.


How about cleaning up also spe? It contains a large number of functions 
which are contained in math as well, but with a terrible name (e.g., 
"spesih(x)" instead of "sinh(x)"). In theory, of course, this will break 
existing code although I am absolutely sure that nobody ever has used 
these functions.


Another idea: Errors in spe (and probably everywhere else) terminate the 
program with a RunError. This is not up to date any more. How about 
throwing an exception? Or, maybe, I could add a procedure 
"NumLibError(ErrCode: Integer)" which by default throws an exception 
with a message corresponding to the ErrCode, or, if compiled with 
$DEFINE RUNTIME_ERRORS, terminates the program like before with a 
RunError(ErrCode).



Am 14.03.2017 um 09:58 schrieb Marco van de Voort:

In our previous episode, Werner Pamler said:

is no way to check whether a value is "equal" to NaN. In math, however,
there is a function IsNaN(). And my feeling is that these special
numbers NaN and Infinity are implemented in math in a more general way
than in numlib. An idea would be to remove NaN and Infinity from the
numlib unit "typ" to replace them by the math values.

No, cleaning up "typ" a bit using math is no problem. RTL generally have
functions like this since coprocessors are standard. Just keep the
separation of typing (arbint/arbfloat) a bit, it can be useful to change the
library's precision.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Math and numlib

2017-03-14 Thread Marco van de Voort
In our previous episode, Werner Pamler said:
> 
> is no way to check whether a value is "equal" to NaN. In math, however, 
> there is a function IsNaN(). And my feeling is that these special 
> numbers NaN and Infinity are implemented in math in a more general way 
> than in numlib. An idea would be to remove NaN and Infinity from the 
> numlib unit "typ" to replace them by the math values.

No, cleaning up "typ" a bit using math is no problem. RTL generally have
functions like this since coprocessors are standard. Just keep the
separation of typing (arbint/arbfloat) a bit, it can be useful to change the
library's precision.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Math and numlib

2017-03-14 Thread Michael Van Canneyt



On Mon, 13 Mar 2017, Werner Pamler wrote:


Hi everybody - my first post here...

At the moment I am spending some time with fpc's numlib and writing a 
wrapper for a more versatile fitting procedure. Are there any problems 
to add the unit math to the uses clause of some numlib units? I want to 
use the value NaN (not-a-number) which is defined in numlib, but there 
is no way to check whether a value is "equal" to NaN. In math, however, 
there is a function IsNaN(). And my feeling is that these special 
numbers NaN and Infinity are implemented in math in a more general way 
than in numlib. An idea would be to remove NaN and Infinity from the 
numlib unit "typ" to replace them by the math values.


You can use the routines from the system unit for this.

http://www.freepascal.org/docs-html-3.0.0/rtl/system/textended80rec.html
http://www.freepascal.org/docs-html-3.0.0/rtl/system/tdoublerec.html
http://www.freepascal.org/docs-html-3.0.0/rtl/system/tsinglerec.html

function SpecialType.

Michael.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] Math and numlib

2017-03-14 Thread Werner Pamler

Hi everybody - my first post here...

At the moment I am spending some time with fpc's numlib and writing a 
wrapper for a more versatile fitting procedure. Are there any problems 
to add the unit math to the uses clause of some numlib units? I want to 
use the value NaN (not-a-number) which is defined in numlib, but there 
is no way to check whether a value is "equal" to NaN. In math, however, 
there is a function IsNaN(). And my feeling is that these special 
numbers NaN and Infinity are implemented in math in a more general way 
than in numlib. An idea would be to remove NaN and Infinity from the 
numlib unit "typ" to replace them by the math values.


Werner
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel