PB still using Carbon for file functions?

Mac OSX specific forum
User avatar
Kukulkan
Addict
Addict
Posts: 1415
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

PB still using Carbon for file functions?

Post by Kukulkan »

If I compile a small dylib with nothing special, otool returns:

[MyName@mac 17:46:22 ~/src/sdks]$otool -L libMyName2.dylib
libMyName2.dylib:
/Users/MyName/src/sdks/libMyName2.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1094.0.0)

As soon as I simply use a file function like FileSize(), it looks like this:

MyName@mac 17:46:57 ~/src/sdks]$otool -L libMyName2.dylib
libMyName2.dylib:
/Users/MyName/src/sdks/libMyName2.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
/System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 153.0.0)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 52.0.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1094.0.0)

Is this correct? How to prevent? I have not chosen any Subsystem in the IDE or somewhere else.

Kukulkan
User avatar
Kukulkan
Addict
Addict
Posts: 1415
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: PB still using Carbon for file functions?

Post by Kukulkan »

Also, Random() function forces PB to include the whole Cocoa stuff:

/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 17.0.0)

How to generate random numbers and avoid linking the whole Cocoa stuff?

Problem is, that PB throws warning messages if I use a dylib that includes Carbon and/or Cocoa: http://www.purebasic.fr/english/viewtop ... 19&t=54771

Kukulkan
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3944
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: PB still using Carbon for file functions?

Post by wilbert »

Kukulkan wrote:How to generate random numbers and avoid linking the whole Cocoa stuff?
I don't know about the other questions you have but when it comes to random number generation, you can use your own generator.
Here's two algorithms I ported myself to PureBasic http://www.purebasic.fr/english/viewtop ... 12&t=49263
you will probably find other ones as well if you do a forum search.
Currently the seed function for both algorithms in the code I linked uses Date() to set an initial seed. If this triggers an unwanted framework, you will have to use something else to set the initial seed.
For example

Code: Select all

ImportC ""
  mach_absolute_time.q()
EndImport

mwc256seed(mach_absolute_time())
cmwc4096seed(mach_absolute_time())
Windows (x64)
Raspberry Pi OS (Arm64)
Post Reply