Re: [fpc-pascal] h2pas fails on c++ header file
Op 1/30/2019 om 11:57 AM schreef Giuliano Colla: What I'm doing wrong? Using a C header converter or a C++ header file. & is not proper C. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] trying to use C code in .pas on WIN32
On Thu, Jan 31, 2019 at 7:35 AM Sven Barth via fpc-pascal wrote: > > This is on an evil windows machine > Windows is one of FPC's main targets, we can do without such "expletives". Maybe he has WinME ??? -- Bart ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] trying to use C code in .pas on WIN32
Am Do., 31. Jan. 2019, 15:26 hat Bart geschrieben: > On Thu, Jan 31, 2019 at 7:35 AM Sven Barth via fpc-pascal > wrote: > > > > This is on an evil windows machine > > Windows is one of FPC's main targets, we can do without such > "expletives". > > Maybe he has WinME ??? > Well, I was rather happy with my WinME. Don't know why everyone is always complaining about it... 🤷♀️ Also: FPC doesn't work anymore on Win9x 😝 Regards, Sven > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] h2pas fails on c++ header file
Il 30/01/2019 13:17, Marco van de Voort ha scritto: Op 1/30/2019 om 11:57 AM schreef Giuliano Colla: What I'm doing wrong? Using a C header converter or a C++ header file. & is not proper C. That is because h2pas is unable to handle it, or because fpc is unable to generate the proper code for a c++ parameter by reference? -- Do not do to others as you would have them do to you.They might have different tastes. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] h2pas fails on c++ header file
Am Do., 31. Jan. 2019, 17:38 hat Giuliano Colla < giuliano.co...@fastwebnet.it> geschrieben: > Il 30/01/2019 13:17, Marco van de Voort ha scritto: > > > > > Op 1/30/2019 om 11:57 AM schreef Giuliano Colla: > >> > >> What I'm doing wrong? > >> > > Using a C header converter or a C++ header file. & is not proper C. > > > > That is because h2pas is unable to handle it, or because fpc is unable > to generate the proper code for a c++ parameter by reference > The former. For the later you'd either use var or constref. Though there'd still be the topic of name mangling... (FPC's cppdecl is not that good yet) Regards, Sven > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] trying to use C code in .pas on WIN32
sven, so I just tried, what I think you said: procedure HelloC; cdecl; external name 'HelloC'; pcode.pas(19,1) Error: Undefined symbol: _HelloC sorry for complaining about windows, but i feel like this is more difficult on windows. All of the FPC examples, seem to run without this extra '_' business and i suspect they are on linux Os macOs. Here at work I'm on a windows machine, but at home I'm happily running FPC on a mac -- Sent from: http://free-pascal-general.1045716.n5.nabble.com/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] trying to use C code in .pas on WIN32
On Thu, 2019-01-31 at 11:00 -0700, conlin664 via fpc-pascal wrote: > sven, > > so I just tried, what I think you said: > > procedure HelloC; cdecl; external name 'HelloC'; > > pcode.pas(19,1) Error: Undefined symbol: _HelloC > > > sorry for complaining about windows, but i feel like this is more difficult > on windows. > All of the FPC examples, seem to run without this extra '_' business and i > suspect they are on linux Os macOs. You could rename your "HelloC.o to "_HelloC.o" before archiving inte the library? Not that beautiful, but would be working, wouldn't it? @Sven: Maybe it is a later addition, but her on fpc 2.6.4 your syntax is not mentioned in the Programmers Guide (prog.pdf). If i did look carefully enough there is no description of the syntax for: "external name " And more, those details of naming and the different name conventions on Win32 and Win64 are missing, too. I think there should be at least a wiki page or better some explanations in the Programmers Guide. -- Marc Santhoff ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] trying to use C code in .pas on WIN32
On Thu, January 31, 2019 21:57, Marc Santhoff wrote: > On Thu, 2019-01-31 at 11:00 -0700, conlin664 via fpc-pascal wrote: >> sven, >> >> so I just tried, what I think you said: >> >> procedure HelloC; cdecl; external name 'HelloC'; >> >> pcode.pas(19,1) Error: Undefined symbol: _HelloC . . > You could rename your "HelloC.o to "_HelloC.o" before archiving inte the > library? Not that beautiful, but would be working, wouldn't it? @Marc: No, because 'HelloC' is name of the procedure, not of the object file. @John: I noticed that you use a very old FPC version (2.4.4?) Do you get the same problem with the latest release? Moreover - wouldn't 'stdcall' be more appropriate than 'cdecl' in your case? What does 'objdump -t ccode.o' show about HelloC? Tomas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] trying to use C code in .pas on WIN32
Am Do., 31. Jan. 2019, 22:03 hat Marc Santhoff geschrieben: > On Thu, 2019-01-31 at 11:00 -0700, conlin664 via fpc-pascal wrote: > > sven, > > > > so I just tried, what I think you said: > > > > procedure HelloC; cdecl; external name 'HelloC'; > > > > pcode.pas(19,1) Error: Undefined symbol: _HelloC > > > > > > sorry for complaining about windows, but i feel like this is more > difficult > > on windows. > > All of the FPC examples, seem to run without this extra '_' business and > i > > suspect they are on linux Os macOs. > > You could rename your "HelloC.o to "_HelloC.o" before archiving inte the > library? Not that beautiful, but would be working, wouldn't it? > That is the object file, not the symbol. The symbol is the important part here. > @Sven: > Maybe it is a later addition, but her on fpc 2.6.4 your syntax is not > mentioned in the Programmers Guide (prog.pdf). > > If i did look carefully enough there is no description of the syntax for: > > "external name " > It's an old syntax. Probably it was simply forgotten to be added to the documentation. Happens... 🤷♀️ And more, those details of naming and the different name conventions on > Win32 > and Win64 are missing, too. I think there should be at least a wiki page or > better some explanations in the Programmers Guide. This is part of the platform's ABI. It's not our job to document that, only to make it usable. Regards, Sven > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] trying to use C code in .pas on WIN32
On Thu, 2019-01-31 at 22:42 +0100, Tomas Hajny wrote: > On Thu, January 31, 2019 21:57, Marc Santhoff wrote: > > On Thu, 2019-01-31 at 11:00 -0700, conlin664 via fpc-pascal wrote: > > > sven, > > > > > > so I just tried, what I think you said: > > > > > > procedure HelloC; cdecl; external name 'HelloC'; > > > > > > pcode.pas(19,1) Error: Undefined symbol: _HelloC > > . > . > > You could rename your "HelloC.o to "_HelloC.o" before archiving inte the > > library? Not that beautiful, but would be working, wouldn't it? > > @Marc: No, because 'HelloC' is name of the procedure, not of the object > file. You and Sven are right of course. I played around using nm, which the op should probably do. > @John: I noticed that you use a very old FPC version (2.4.4?) Do you get > the same problem with the latest release? > > Moreover - wouldn't 'stdcall' be more appropriate than 'cdecl' in your > case? What does 'objdump -t ccode.o' show about HelloC? That's what I asked for, then overlooked it... -- Marc Santhoff ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal