Page 1 of 1

Can not use a structure in an Import

Posted: Fri Oct 10, 2025 1:04 pm
by infratec
I had this 'bug' in macOS:
viewtopic.php?t=87191

Now I stumpled across the same error when I use the C backend (x86) in windows:
error: unkonw type_name 's_pjsip_cfg_t'
136 | extern s_pjsip_cfg_t v_pjsip_sip_cfg_var asm("_pjsip_sip_cfg_var");
purebasic.c in function 'f_startsipstack':
purebasic.c46167:20: error: request for member 'f_disable_tcp_swi
More is not visible in the Assembler error message requester.

Re: Can not use a structure in an Import

Posted: Fri Oct 10, 2025 1:26 pm
by Fred
Did you try with 6.30b3 ? I tried here with x86 and x64 on Windows and it seems to work

Code: Select all

Macro pj_bool_t : i : EndMacro

Structure pjsip_cfg_t Align #PB_Structure_AlignC
  allow_port_in_fromto_hdr.pj_bool_t
  accept_replace_in_early_state.pj_bool_t
  allow_tx_hash_in_uri.pj_bool_t
  disable_rport.pj_bool_t
  disable_tcp_switch.pj_bool_t
  disable_tls_switch.pj_bool_t
  follow_early_media_fork.pj_bool_t
  req_has_via_alias.pj_bool_t
  resolve_hostname_to_get_interface.pj_bool_t
  disable_secure_dlg_check.pj_bool_t
  use_compact_form.pj_bool_t
  accept_multiple_sdp_answers.pj_bool_t
  keep_inv_after_tsx_timeout.pj_bool_t
EndStructure

ImportC ""
    pjsip_sip_cfg_var.pjsip_cfg_t
  EndImport
  
  a = pjsip_sip_cfg_var

Re: Can not use a structure in an Import

Posted: Fri Oct 10, 2025 1:44 pm
by infratec
I just tried 6.30b3 x86 C backend,

but I can not compile the project because:
Declare does not fit the real procedure

Code: Select all


Structure Object
    Server_ID.i
    
    Network_Thread_ID.i
EndStructure

Prototype.i Prototype_Event_Callback(*Object, *Client, Event.i, *Custom_Structure=#Null)

Declare.i Event_Callback(*Object.Object, *Callback.Prototype_Event_Callback)

Code: Select all

Procedure.i Event_Callback(*Object.Object, *Callback.Prototype_Event_Callback)
Declare and Procedure are identical :shock:

In 6.21 it works without this problem.

Re: Can not use a structure in an Import

Posted: Fri Oct 10, 2025 1:51 pm
by Fred
Yes, I corrected this issue for the next beta. viewtopic.php?t=87674

Re: Can not use a structure in an Import

Posted: Fri Oct 10, 2025 1:52 pm
by infratec
So I have to wait for the next beta to test this.

Re: Can not use a structure in an Import

Posted: Tue Oct 14, 2025 8:03 am
by idle
infratec wrote: Fri Oct 10, 2025 1:52 pm So I have to wait for the next beta to test this.
drop the pointer or move procedure to where you don't need to declare it and leave the pointer

Code: Select all

Declare.i Event_Callback(*Object.Object, Callback.Prototype_Event_Callback)
Procedure.i Event_Callback(*Object.Object, Callback.Prototype_Event_Callback)
When I came across it, I suffered a little hair loss from being a dyslexic :lol: