Skip to content

Is it possible to call C functions? #719

Answered by arakov
GB18030-2000 asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, the language has support for calling C functions declared in shared libraries (only C functions so far, maybe later C++ as well).

For example, in system\net\win_sockets.l, a function from WS2_32 shared library is called:

  SOCKADDR_IN addr := SOCKADDR_IN.Default;
  addr.Port := port;
  addr.Family := system'net'AF_INET;
  addr.Ip_address := ip_address;
    
  pointer ptr := addr;
  int retVal := extern WS2_32.connect(_handle, ptr, SOCKADDR_IN_SIZE);

Replies: 17 comments 50 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by GB18030-2000
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@arakov
Comment options

Comment options

You must be logged in to vote
1 reply
@arakov
Comment options

Comment options

You must be logged in to vote
1 reply
@arakov
Comment options

Comment options

You must be logged in to vote
5 replies
@arakov
Comment options

@groggily
Comment options

@groggily
Comment options

@arakov
Comment options

@arakov
Comment options

Comment options

You must be logged in to vote
3 replies
@arakov
Comment options

@arakov
Comment options

@groggily
Comment options

Comment options

You must be logged in to vote
1 reply
@arakov
Comment options

Comment options

You must be logged in to vote
3 replies
@arakov
Comment options

@groggily
Comment options

@arakov
Comment options

Comment options

You must be logged in to vote
9 replies
@groggily
Comment options

@arakov
Comment options

@arakov
Comment options

@groggily
Comment options

@arakov
Comment options

Comment options

You must be logged in to vote
1 reply
@arakov
Comment options

Comment options

You must be logged in to vote
2 replies
@GB18030-2000
Comment options

@arakov
Comment options

Comment options

You must be logged in to vote
5 replies
@arakov
Comment options

@GB18030-2000
Comment options

@arakov
Comment options

@GB18030-2000
Comment options

@arakov
Comment options

Comment options

You must be logged in to vote
7 replies
@arakov
Comment options

@blearily
Comment options

@arakov
Comment options

@arakov
Comment options

@blearily
Comment options

Comment options

You must be logged in to vote
7 replies
@arakov
Comment options

@GB18030-2000
Comment options

@arakov
Comment options

@blearily
Comment options

@blearily
Comment options

Comment options

You must be logged in to vote
3 replies
@arakov
Comment options

@blearily
Comment options

@arakov
Comment options

Comment options

You must be logged in to vote
1 reply
@arakov
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
5 participants