It is currently Fri Dec 06, 2019 9:42 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: using unknown api calls with purebasic
PostPosted: Wed Aug 23, 2017 12:26 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Apr 10, 2017 6:17 pm
Posts: 301
Location: Germany
I Have an old project that used the statfs call in the past, but im unable to get it to compile with purebasic 5.61 beta 1. Using the pbsoimporter as mentioned here http://www.purebasic.fr/english/viewtopic.php?f=15&t=22609&hilit=statfs neither worked in the amd64 nor the x86 version of linux 5.61 beta 1

Code:
StatFSBuffer$ = Space(200)

  Res = statfs_(Path$, @StatFSBuffer$)
 
  If (Res = 0)
    Blocks.i = PeekL(@StatFSBuffer$ + 16)
  endif


PB 5.61 beta 1 seems unable to resolve the api call and just aborts compilation with
Quote:
[13:11:57] [COMPILER] Line 480: statfs_() is not a function, array, list, map or macro.


Is it my mistake or a 5.61 beta problem?

ps: installing a previous major version now to see if that works

_________________
webpage


Top
 Profile  
Reply with quote  
 Post subject: Re: using unknown api calls with purebasic
PostPosted: Wed Aug 23, 2017 2:49 pm 
Offline
Addict
Addict
User avatar

Joined: Thu Apr 21, 2005 2:38 pm
Posts: 1656
Location: Germany
You shouldn't use statfs anymore because it's deprecated and OS-specific. Instead of statfs you should use statvfs because it's POSIX compliant and handles large file sizes better.

You have to use the following ImportC statement (and also define the structure of statvfs before this import) for PureBasic to resolve the API call:
Code:
ImportC ""
  statvfs(Path.P-UTF8, *Buffer.statvfs)
EndImport

You may take a look into remi_meier's example or uwekel's example (which is derived from remi_meier's one and reports a volume's space, used space and free space).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye