mirror of
https://github.com/tribufu/sdk-rust
synced 2025-06-16 03:04:19 +00:00
Add Premake and FFI Bindings
This commit is contained in:
12
Examples/C/Hello.c
Normal file
12
Examples/C/Hello.c
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (c) TribuFu. All Rights Reserved
|
||||
|
||||
#include "stdio.h"
|
||||
|
||||
#include "TribuFu.h"
|
||||
|
||||
extern int32_t Hello(void);
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("TribuFu SDK = %d\n", Hello());
|
||||
}
|
24
Examples/CSharp/Hello.cs
Normal file
24
Examples/CSharp/Hello.cs
Normal file
@ -0,0 +1,24 @@
|
||||
// Copyright (c) TribuFu. All Rights Reserved
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace CSharp
|
||||
{
|
||||
class Program
|
||||
{
|
||||
#if WINDOWS_PLATFORM
|
||||
const string TribuFu = "TribuFu";
|
||||
#else
|
||||
const string TribuFu = "libTribuFu";
|
||||
#endif
|
||||
|
||||
[DllImport(TribuFu)]
|
||||
public static extern int Hello();
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("TribuFu SDK = " + Hello());
|
||||
}
|
||||
}
|
||||
}
|
14
Examples/Cpp/Hello.cpp
Normal file
14
Examples/Cpp/Hello.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright (c) TribuFu. All Rights Reserved
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "TribuFu.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern int32_t Hello();
|
||||
|
||||
int main()
|
||||
{
|
||||
cout << "TribuFu SDK = " << (int)TribuFu::Hello() << "\n";
|
||||
}
|
Reference in New Issue
Block a user