Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread Marco van de Voort
In our previous episode, Henry Vermaak said: > >> > I'd just add the decoration manually. It is typically a one-off effort. > >> > >> Except if you have cross platform code, then you need an ifdef for > >> every function you import :( > > > > It's still a one off. Annoying for hundreds of calls, bu

Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread Henry Vermaak
On 5 March 2010 13:55, Marco van de Voort wrote: > In our previous episode, Henry Vermaak said: >> Maybe a command line param that does a more fuzzy linking? >> >> >> I guess you can still use ld instead of the internal llinker (and even >> >> import libs). >> > >> > I'd just add the decoration ma

Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread Marco van de Voort
In our previous episode, Henry Vermaak said: > Maybe a command line param that does a more fuzzy linking? > > >> I guess you can still use ld instead of the internal llinker (and even > >> import libs). > > > > I'd just add the decoration manually. It is typically a one-off effort. > > Except if

Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread Henry Vermaak
On 5 March 2010 13:19, Marco van de Voort wrote: > In our previous episode, Henry Vermaak said: >> >> It's a bit useless if you can't link to any other libraries, no? > > You can, you just have to specify the decoration. Or if there is a large > scale need a modifier or directive to modify stdcall

Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread Marco van de Voort
In our previous episode, Henry Vermaak said: > > But the system libraries using stdcall do not use it, so apparantly it is > > turned off there. It makes more sense to make stdcall adhere to the system > > calling convention than the MSVC mangled version one. (that'd be a new > > modifier) > > It'

Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread cobines
2010/3/5 Henry Vermaak : > On 5 March 2010 12:22, Henry Vermaak wrote: >> >> You can pass --kill-at as an option to ld when you link the library >> (or gcc -Wl,--kill-at). > > You can even use --enable-stdcall-fixup when you you link your pascal > program with ld.  That should try and do what the

Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread Henry Vermaak
On 5 March 2010 12:26, Marco van de Voort wrote: > In our previous episode, Henry Vermaak said: >> > You're right, apparently it has nothing to do with C. >> >> According to this, it has: >> >> http://en.wikipedia.org/wiki/Name_mangling#C_name_decoration_in_Microsoft_Windows > > But the system lib

Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread Henry Vermaak
On 5 March 2010 12:22, Henry Vermaak wrote: > > You can pass --kill-at as an option to ld when you link the library > (or gcc -Wl,--kill-at). You can even use --enable-stdcall-fixup when you you link your pascal program with ld. That should try and do what the docs call "fuzzy linking". See: ht

Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread Marco van de Voort
In our previous episode, Henry Vermaak said: > > You're right, apparently it has nothing to do with C. > > According to this, it has: > > http://en.wikipedia.org/wiki/Name_mangling#C_name_decoration_in_Microsoft_Windows But the system libraries using stdcall do not use it, so apparantly it is tu

Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread Henry Vermaak
On 5 March 2010 11:47, cobines wrote: > > You're right, apparently it has nothing to do with C. According to this, it has: http://en.wikipedia.org/wiki/Name_mangling#C_name_decoration_in_Microsoft_Windows > > I am using MinGW GCC and it also adds this decoration. > > Someone did this with Borla

Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread cobines
2010/3/5 Jonas Maebe : > > On 05 Mar 2010, at 06:36, cobines wrote: > >> Is there a way I can declare the external function to use "C" style >> mangling? > > That's currently only possible if the function also uses the C calling > convention. Ah, I see. Thanks. 2010/3/5 Marco van de Voort : > In

Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread Marco van de Voort
In our previous episode, cobines said: > > {$LINKLIB bz2} > function BZ2_bzCompressInit(...): Integer; stdcall; external name > '_bz2_bzcompressi...@16'; > > Is there a way I can declare the external function to use "C" style mangling? That's (VB like) decoration, not C mangling. Only VS compile

Re: [fpc-pascal] Linking statically C code with stdcall functions

2010-03-05 Thread Jonas Maebe
On 05 Mar 2010, at 06:36, cobines wrote: Is there a way I can declare the external function to use "C" style mangling? That's currently only possible if the function also uses the C calling convention. Jonas ___ fpc-pascal maillist - fpc-pas