Files
llgo/internal/runtime/c/c.go

49 lines
1.2 KiB
Go
Raw Normal View History

2024-04-28 07:08:33 +08:00
/*
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
2024-04-29 09:51:32 +08:00
package c
2024-04-28 07:08:33 +08:00
2024-04-29 17:58:10 +08:00
import "C"
2024-04-28 07:08:33 +08:00
import "unsafe"
const (
2024-04-29 09:51:32 +08:00
LLGoPackage = "decl"
2024-04-28 07:08:33 +08:00
)
2024-04-30 08:23:55 +08:00
//go:linkname Str llgo.cstr
func Str(string) *int8
2024-04-29 09:51:32 +08:00
2024-04-29 13:59:06 +08:00
//go:linkname Alloca llgo.alloca
2024-04-29 09:51:32 +08:00
func Alloca(size uintptr) unsafe.Pointer
2024-04-30 18:22:56 +08:00
//go:linkname AllocaCStr llgo.allocaCStr
func AllocaCStr(s string) *int8
2024-04-29 13:59:06 +08:00
//go:linkname Unreachable llgo.unreachable
2024-04-29 09:51:32 +08:00
func Unreachable()
2024-05-01 07:26:51 +08:00
//go:linkname Rand C.rand
func Rand() C.int
2024-04-28 07:08:33 +08:00
//go:linkname Malloc C.malloc
func Malloc(size uintptr) unsafe.Pointer
2024-04-29 09:51:32 +08:00
//go:linkname Memcpy C.memcpy
func Memcpy(dst, src unsafe.Pointer, n uintptr) unsafe.Pointer
//go:linkname Printf C.printf
2024-04-29 17:58:10 +08:00
func Printf(format *int8, __llgo_va_list ...any) C.int