[fpc-pascal] Static linking to C library on Windows

2019-11-27 Thread Ryan Joseph via fpc-pascal
Moving on to Windows now and more basic problems. I've built from Python sources again but I'm not sure about static libraries on Windows. There is a .dll which is a dynamic library and .lib which I assume is the static library. Again I link using: {$linklib python37.lib} But I get: "Error: In

Re: [fpc-pascal] Static linking to C library on Linux

2019-11-27 Thread Ryan Joseph via fpc-pascal
> On Nov 27, 2019, at 2:22 PM, Jonas Maebe wrote: > > There is no tool that can show this, because a static library is just a > collection of random object files. It does not contain any metadata > about where these symbols are supposed to come from (and they could o, > fact come from anywhere,

Re: [fpc-pascal] Static linking to C library on Linux

2019-11-27 Thread Ryan Joseph via fpc-pascal
> On Nov 27, 2019, at 11:25 AM, Karoly Balogh (Charlie/SGR) > wrote: > > Yes. By Default, FPC doesn't link against libc on Linux by default, only > when some more advanced things, say, threading is used. To the contrary on > Darwin (macOS), we always link against libc. There comes your differe

[fpc-pascal] Static linking to C library on Linux

2019-11-27 Thread Ryan Joseph via fpc-pascal
I'm trying to link to a static library (built from Python sources) in Pascal and having troubles on Linux. On Mac where I have experience I successfully link and every works as expected but on Linux I get slews of linker errors in what appear to be standard C library functions. For example: /u

Re: [fpc-pascal] Pre-allocated TFPGList or similar

2019-11-24 Thread Ryan Joseph via fpc-pascal
> On Nov 24, 2019, at 3:57 AM, Sven Barth via fpc-pascal > wrote: > > What you're looking for is the Count property. Setting it is supported by the > untyped lists in Classes, the generic ones in FGL as well as those in > Generics.Collections. > > === code begin === > > list := TList.Creat

[fpc-pascal] Variant part in objects?

2019-11-24 Thread Ryan Joseph via fpc-pascal
Is there a reason that objects don't support variant sections like with records? Maybe they mess with the VMT table when virtual methods are added? I just posted my "advanced objects" patch (https://bugs.freepascal.org/view.php?id=36350) and all it does is add "class operators" to objects but I

[fpc-pascal] Pre-allocated TFPGList or similar

2019-11-23 Thread Ryan Joseph via fpc-pascal
I need a pre-grown list which I can put (not insert!) items into at indexes without getting "List index out of bounds" errors. For example I want to start with a list that has 10 empty indexes: list := TList.Create(10); // 10 empty slots! list[5] := someItem; Is this possible using any list ty

Re: [fpc-pascal] How to translate C macros which use stringification?

2019-11-23 Thread Ryan Joseph via fpc-pascal
> On Nov 23, 2019, at 2:47 AM, Gabor Boros wrote: > > Can I do the same thing with FPC in a simple way? I translate some C source > to FPC and try to follow the original code. 99% certain this can't be done. I don't even think there's RTTI for local variable names but I could be wrong. Rega

Re: [fpc-pascal] cvar external symbol name

2019-11-21 Thread Ryan Joseph via fpc-pascal
> On Nov 21, 2019, at 3:40 PM, Jonas Maebe wrote: > > The only thing cvar does is to mangle symbol name using the default > C-style name mangling. Specifying an explicit symbol name would just > overwrite whatever effect "cvar" has, so combining both is useless and > rejected. Thanks I see now

Re: [fpc-pascal] get_caller_frame

2019-11-21 Thread Ryan Joseph via fpc-pascal
> On Nov 21, 2019, at 1:41 AM, Sven Barth via fpc-pascal > wrote: > > No. On x86 it's essentially the content of the EBP/RBP register which is > (assuming no optimizations are done) essentially the ESP/RSP register of the > calling function. This is only used by the exception handling to hav

[fpc-pascal] cvar external symbol name

2019-11-21 Thread Ryan Joseph via fpc-pascal
Do cvars not allow external symbol names like functions do? With function I can declare a name but for cvar I'm getting an error. PyBaseString_Type:PPyTypeObject; cvar; external name 'somename'; Regards, Ryan Joseph ___ fpc-pascal maillist

Re: [fpc-pascal] Add API to official documentation search

2019-11-20 Thread Ryan Joseph via fpc-pascal
> On Nov 20, 2019, at 5:25 AM, Anthony Walter via fpc-pascal > wrote: > > You said, "but its got bugs and I haven't been able to contact the developer > to fix them" > > What are the bugs you want fixed? There you are. ;) There are stray tags which are messing things up. For example: http

Re: [fpc-pascal] get_caller_frame

2019-11-20 Thread Ryan Joseph via fpc-pascal
> On Nov 20, 2019, at 1:56 AM, Sven Barth via fpc-pascal > wrote: > > It returns the address of the caller's frame pointer. See also > https://www.freepascal.org/docs-html/rtl/system/get_caller_frame.html > > It's mainly used in context of raising exceptions with the help of a second > func

[fpc-pascal] get_caller_frame

2019-11-19 Thread Ryan Joseph via fpc-pascal
I came across get_caller_frame in some unrelated code and I was just curious about this so I wanted to ask. What does get_caller_frame return exactly? Is this a pointer to a stack frame that could be copied to the heap? I'm still interested in how we could add some form of coroutine like behav

Re: [fpc-pascal] Add API to official documentation search

2019-11-18 Thread Ryan Joseph via fpc-pascal
> On Nov 18, 2019, at 1:15 PM, Michael Van Canneyt > wrote: > > As with all things FPC, the sources are available: > > svn co https://svn.freepascal.org/svn/html/docsearch docsearch > > Feel free to suggest improvements. It should be easy enough to add a first > element that contains an exac

Re: [fpc-pascal] Add API to official documentation search

2019-11-18 Thread Ryan Joseph via fpc-pascal
> On Nov 17, 2019, at 5:20 PM, Michael Van Canneyt > wrote: > > That would be me. > > And there already is an API. How else ? This is Free Pascal ! Sorry for the late response. Nice this is exactly what I wanted. However when I started to look at the actual results I'm confused. For my exa

[fpc-pascal] Add API to official documentation search

2019-11-17 Thread Ryan Joseph via fpc-pascal
Could FPC make an API for the official documentation search at https://www.freepascal.org/docsearch/docsearch.var so we could make calls like: https://www.freepascal.org/docsearch/docsearch.var?word=List and get back a JSON object that had the search results? This is important for integration w

Re: [fpc-pascal] Generics in Objective-C mode bug?

2019-11-11 Thread Ryan Joseph via fpc-pascal
> On Nov 11, 2019, at 1:25 PM, Sven Barth via fpc-pascal > wrote: > > Generics are not considered supported with Objective Pascal types. > There's really not any reason they shouldn't though. If you specialized with "string" for example that wouldn't be anything out of the ordinary so why

[fpc-pascal] Generics in Objective-C mode bug?

2019-11-11 Thread Ryan Joseph via fpc-pascal
Is this a bug I should report? Knowing what I do about generics now I think the type check needs to be suspended until the type is actually specialized. {$mode objfpc} {$modeswitch objectivec2} program test; type generic TCocoaObject = objcclass (NSObject) // ERROR: The type "TCocoaObjec

Re: [fpc-pascal] Generic operator overload problem

2019-11-09 Thread Ryan Joseph via fpc-pascal
> On Nov 8, 2019, at 5:32 PM, Sven Barth via fpc-pascal > wrote: > > This indeed appears to be a bug, but fixing it leads to some compilation > problems in Generics.Collections that need to be solved as well. So please > report this as a bug so that I don't forget it. Great, thanks. https:

Re: [fpc-pascal] Generic type conflicts

2019-11-09 Thread Ryan Joseph via fpc-pascal
> On Nov 7, 2019, at 12:28 PM, Ben Grasset via fpc-pascal > wrote: > > {$IF GetTypeKind(T) in [tkInteger, tkInt64, tkQWord]} > Result := A div B > {$ELSEIF GetTypeKind(T) = tkFloat} > Result := A / B > {$ELSE} > Result := Default(T); > {$ENDIF} This is what I hinted in my

Re: [fpc-pascal] Generic type conflicts

2019-11-02 Thread Ryan Joseph via fpc-pascal
> On Nov 2, 2019, at 11:06 AM, Cyrax via fpc-pascal > wrote: > > You need to do a explicit typecasting. > > ... > fac:=Sqrt(Sqr(TScalar(x)) + Sqr(TScalar(y))); > ... > fac:=1.0/TScalar(fac); Doesn't work. Try running the example. Regards, Ryan Joseph ___

[fpc-pascal] Generic type conflicts

2019-11-02 Thread Ryan Joseph via fpc-pascal
I've wanted to make a generic version of a vector for a while but I always give up because it seems not very possible. It's probably not even a great idea because many methods don't translate between float and integer but I wanted to prevent other code duplication if possible. Here's an example

[fpc-pascal] Generic operator overload problem

2019-11-02 Thread Ryan Joseph via fpc-pascal
Is this a bug or did I do something wrong? The minus operator overload seems to be getting confused and I get a "Can't determine which overloaded function to call" error as a result. {$mode objfpc} {$modeswitch advancedrecords} program generic_vector; uses Math; type generic TVec2 = record

<    1   2   3   4   5