Search found 9288 matches

by fxm
Dec 03, 2019 20:13
Forum: General
Topic: c qsort compare callback as member function?
Replies: 14
Views: 424

Re: c qsort compare callback as member function?

I did not propose an example with qsort_s because I do not know how to get it back with FreeBASIC (Windows).

[edit]
But see dodicat's example below.
by fxm
Dec 03, 2019 17:22
Forum: General
Topic: c qsort compare callback as member function?
Replies: 14
Views: 424

Re: c qsort compare callback as member function?

Therefore, the principle using either 'qsort' or 'qsort_s' would be similar to the following example with either callback/[member_]launch or callback_context/[member_]launch_context: Sub launch (Byval psub As Sub(Byref str1 As String, Byref str2 As String)) psub("parameter #1.1", "par...
by fxm
Dec 03, 2019 14:08
Forum: Libraries
Topic: Missing Include Library
Replies: 7
Views: 429

Re: Missing Include Library

Look at page Compiler Option: -l -l < libname > is the command to add the library libname to the linker's list: - where '-l' is only a prefix to add a library file, - and 'libname' is the user name of the library. The internal name of the static library becomes 'lib < libname> .a...
by fxm
Dec 03, 2019 12:50
Forum: Beginners
Topic: 0-255 number to byte output
Replies: 2
Views: 110

Re: 0-255 number to byte output

For example:

Code: Select all

#include "file.bi"

dim as integer i
open "test.dat" for binary access write as #1
for i = 1 to 100
put #1, , cubyte(int(rnd * 256))
next i
close #1

print filelen("test.dat")

sleep
by fxm
Dec 03, 2019 9:12
Forum: General
Topic: c qsort compare callback as member function?
Replies: 14
Views: 424

Re: c qsort compare callback as member function?

Yes. A very twisted hacking could be to use a non-static member function as callback, but a function declared with a single explicit parameter: - thus, the implicit (first) parameter 'this' would correspond to the first pointer value provided by qsort, - and the only explicit (second) parameter woul...
by fxm
Dec 02, 2019 23:07
Forum: General
Topic: c qsort compare callback as member function?
Replies: 14
Views: 424

Re: c qsort compare callback as member function?

I vaguely remember this now from some other code. But I will probably forget again within a few months. All this is well described on the documentation page 'STATIC (Member)' . And qSortCallback() needs to be static because the compiler needs to know where the function code in memor...
by fxm
Dec 02, 2019 22:25
Forum: General
Topic: c qsort compare callback as member function?
Replies: 14
Views: 424

Re: c qsort compare callback as member function?

'sortOrder()' must be a static array (because called from the static function data_type.qSortCallback()' ), but this array can be included in the Type 'data-type' as a static member ( 'data_type.sortOrder()' ): #include "crt/stdlib.bi" t...
by fxm
Dec 02, 2019 20:36
Forum: Community Discussion
Topic: [DUPLICATED] Namespaces bug (or feature?)
Replies: 5
Views: 207

Re: [DUPLICATED] Namespaces bug (or feature?)

Oh I see. I was talking about the note in ProPgNamespaces (Programmer's Guide / Declarations / Namespaces). I did not put a note in KeyPgNamespace (the keyword page) because in the paragraph syntax, the name of the namespace is not optional. But it seems now useful that I put one here too. [edit] Do...
by fxm
Dec 02, 2019 20:18
Forum: Community Discussion
Topic: [DUPLICATED] Namespaces bug (or feature?)
Replies: 5
Views: 207

Re: Namespaces bug (or feature?)

paul doe wrote:Interestingly enough, the 'Notes' section of the Wiki wasn't in the .chm file I use here for the 1.07.1 version.

Weird, I see it in the files 'FB-manual-1.07.0.chm' and 'FB-manual-1.07.1.chm'.
by fxm
Dec 02, 2019 6:09
Forum: General
Topic: [updated topic] member function ptr
Replies: 31
Views: 813

Re: [updated topic] member function ptr

Important restriction: As commented out in my example, I repeat that this hacking by down-casting the run-time type of an object only works for derived types without data members (having only procedure members and/or static data members). Otherwise, the override derived procedures could attempt to ...
by fxm
Dec 01, 2019 16:31
Forum: Beginners
Topic: String Processing
Replies: 10
Views: 386

Re: String Processing

The string variable InputFile and OutputFile must be initialized with filenames.
by fxm
Dec 01, 2019 5:51
Forum: Documentation
Topic: Wiki improvements
Replies: 374
Views: 60952

Re: Wiki improvements

Done;
KeyPgFBArray → fxm [Adding warning note on changing values of array descriptor]

Go to advanced search