Search found 2269 matches

by jj2007
Feb 20, 2022 19:12
Forum: General
Topic: Using a static library: linker problems
Replies: 48
Views: 3798

Re: Using a static library: linker problems

Ok, so the library does the memory management. Your solution again sounds pretty non-standard and I'll doubt that you find such a custom memory allocator implementation using a fixed-size ring buffer in common libraries out there. The ring buffer is at least a factor 10 faster than HeapAlloc. I thi...
by jj2007
Feb 20, 2022 18:54
Forum: Beginners
Topic: Search for files by multiple extensions
Replies: 19
Views: 2308

Re: Search for files by multiple extensions

[and exaggerated "type safety" that results in absurd warnings Recompile the Lazarus IDE and count the warnings. :D I don't know that one, but I can imagine. For Pelles C, which is a really nice compiler, I had to write an application named polinkfilter.exe, which filters out all the real...
by jj2007
Feb 20, 2022 18:47
Forum: Beginners
Topic: Search for files by multiple extensions
Replies: 19
Views: 2308

Re: Search for files by multiple extensions

Nice, but if you'd tell us how it's implemented it would be more helpful ;-) GetFiles uses FindFirstFileW, and checks for each file extension if it's contained in the *.bas|*.bi whatever string. It's pretty straightforward, actually. Besides, you could specify a callback function where the user can...
by jj2007
Feb 20, 2022 11:24
Forum: General
Topic: Using a static library: linker problems
Replies: 48
Views: 3798

Re: Using a static library: linker problems

Someone must handle the memory - either the library or the application using the library. No allocating, no free'ing from a user perspective. The library uses a fixed circular buffer, with a maximum size of 160,000 bytes per entry. That should be enough for a Str(123.456). unfortunately that link i...
by jj2007
Feb 20, 2022 11:16
Forum: Beginners
Topic: Search for files by multiple extensions
Replies: 19
Views: 2308

Re: Search for files by multiple extensions

Difficult in FreeBasic, but pretty "basic" in other languages: GetFiles examples\win32\COM\*.bas|*.bi SortFiles date ; most recent on top, please For_ ct=0 To Files$(?)-1 ; print the results PrintLine Str$(GfSize(ct)), Tb$, GfDate$(ct), Spc2$, GfTime$(ct), Tb$, Files$(ct) Next 4982 05.06.2...
by jj2007
Feb 20, 2022 2:50
Forum: General
Topic: Using a static library: linker problems
Replies: 48
Views: 3798

Re: Using a static library: linker problems

Which memory management? Dim Double2String As Function stdcall (byval arg1 as zstring ptr, byval arg2 as double) As zstring ptr Dim As Any Ptr libhandle = DyLibLoad("MbDouble2String.dll") Double2String=DyLibSymbol(libhandle, "Double2String") #define elements 5000000 Dim Shared As...
by jj2007
Feb 20, 2022 2:22
Forum: General
Topic: Are line label pointers possible?
Replies: 44
Views: 3183

Re: Are line label pointers possible?

Nice example, RockTheSchock :D
by jj2007
Feb 20, 2022 2:16
Forum: Beginners
Topic: Finding the largest number.
Replies: 9
Views: 1095

Re: Finding the largest number.

caseih wrote: Feb 20, 2022 1:15The only change I would make to his code is to initialize maxnum to the smallest possible value, such as -9223372036854775808 for a 64-bit integer.
OP uses integers in numarr(counter) = rnd * 10000. There are no negative numbers in the array, therefore -1 is ok for 32- and 64-bit code.
by jj2007
Feb 20, 2022 2:10
Forum: General
Topic: Using a static library: linker problems
Replies: 48
Views: 3798

Re: Using a static library: linker problems

St_W wrote: Feb 20, 2022 2:00Consider having a small library compiled with fbc -dll myLib.bas
I consider a small library not compiled with FreeBasic. There are thousands of them, mostly written in C or C++, and on Windows, almost all of them use zstrings, not BASIC strings.
by jj2007
Feb 20, 2022 0:37
Forum: Beginners
Topic: Finding the largest number.
Replies: 9
Views: 1095

Re: Finding the largest number.

Code: Select all

dim as integer numarr(0 to 99)
dim as integer counter
dim as integer maxnum=-1
randomize timer,3
for counter = 0 to 99
   numarr(counter) = rnd * 10000
next
for counter = 0 to 99
   if numarr(counter)>maxnum Then maxnum = numarr(counter)
next
print "The largest number is ";maxnum
Sleep
by jj2007
Feb 19, 2022 22:10
Forum: General
Topic: Using a static library: linker problems
Replies: 48
Views: 3798

Re: Using a static library: linker problems

My speed test is one million runs, but your dll chokes at 1000000 Yep, you are right, I had erroneously used syscall instead of stdcall. FreeBasic uses the same technical basis for compilation units and linking as C does, thus we also get the same complexity. The complexity is very similar, here ar...
by jj2007
Feb 19, 2022 12:56
Forum: General
Topic: Using a static library: linker problems
Replies: 48
Views: 3798

Re: Using a static library: linker problems

Out of interest: what's wrong with the example code that you say crashes? I can't see anything wrong. Or is the implementation in the library somehow wrong? Mbs=Double2String("%Gf", MyD) ' does some automagic z$ to $ conversion Print "Result A=";Mbs asm int 3 Print "Result ...
by jj2007
Feb 19, 2022 9:33
Forum: General
Topic: Using a static library: linker problems
Replies: 48
Views: 3798

Re: Using a static library: linker problems

Oh. Please just use a DLL! I hate static linking fanboy so much! That is simply a matter of taste (and Munair is absolutely right). Check this archive with an update on my double-to-string conversion for FreeBasic . The point is, and I am sure you agree, that FreeBasic does not offer the most immed...
by jj2007
Feb 19, 2022 0:06
Forum: Community Discussion
Topic: Revamping the forum?
Replies: 129
Views: 20435

Re: Revamping the forum?

Munair wrote: Feb 18, 2022 22:40It would be a great improvement if the search engine would recognize the underscore as a valid text character.
I fully agree: 10961 matches for WM_COMMAND, 99% irrelevant. In contrast, the SMF-powered Masm32 forum search finds only 30 posts, but 100% contain WM_COMMAND.
by jj2007
Feb 18, 2022 22:12
Forum: Community Discussion
Topic: Revamping the forum?
Replies: 129
Views: 20435

Re: Revamping the forum?

With Google, you can find 110 hits using site:freebasic.net "va_first" - i.e. restricted to this site, plus "string" in quotes. Without the site restriction, you get more hits, and the first one points to the documentation. However, most of the rest aren't FB related. With forum ...