Can not use a structure in an Import

All bugs related to new C backend
infratec
Always Here
Always Here
Posts: 7658
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Can not use a structure in an Import

Post 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.
Fred
Administrator
Administrator
Posts: 18342
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Can not use a structure in an Import

Post 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
infratec
Always Here
Always Here
Posts: 7658
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Can not use a structure in an Import

Post 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.
Last edited by infratec on Fri Oct 10, 2025 1:51 pm, edited 1 time in total.
Fred
Administrator
Administrator
Posts: 18342
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Can not use a structure in an Import

Post by Fred »

Yes, I corrected this issue for the next beta. viewtopic.php?t=87674
infratec
Always Here
Always Here
Posts: 7658
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: Can not use a structure in an Import

Post by infratec »

So I have to wait for the next beta to test this.
User avatar
idle
Always Here
Always Here
Posts: 5997
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Can not use a structure in an Import

Post 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:
Post Reply