Update Crate and Examples

This commit is contained in:
GuilhermeWerner
2021-04-18 20:02:28 -03:00
parent b82addd7e5
commit 293aef9dbf
6 changed files with 48 additions and 27 deletions

View File

@ -1,19 +0,0 @@
#include "stdio.h"
#include "Library.h"
extern float Add(float Num1, float Num2);
extern float Divide(float Num1, float Num2);
extern float Multiply(float Num1, float Num2);
extern float Subtract(float Num1, float Num2);
int main()
{
int num1 = 1;
int num2 = 2;
printf("Added: %f\n", Add(num1, num2));
printf("Subtracted: %f\n", Subtract(num1, num2));
printf("Multiplied: %f\n", Multiply(num1, num2));
printf("Divided: %f\n", Divide(num1, num2));
}

14
Examples/C/Main.c Normal file
View File

@ -0,0 +1,14 @@
#include "stdio.h"
#include "Library.h"
int main()
{
int num1 = 1;
int num2 = 2;
printf("Added: %g\n", Add(num1, num2));
printf("Subtracted: %g\n", Subtract(num1, num2));
printf("Multiplied: %g\n", Multiply(num1, num2));
printf("Divided: %g\n", Divide(num1, num2));
}

View File

@ -5,7 +5,7 @@ namespace CSharp
{
class Program
{
#if WINDOWS_PLATFORM
#if PLATFORM_WINDOWS
const string Library = "Library";
#else
const string Library = "libLibrary";

View File

@ -4,11 +4,6 @@
using namespace std;
extern float Add(float Num1, float Num2);
extern float Divide(float Num1, float Num2);
extern float Multiply(float Num1, float Num2);
extern float Subtract(float Num1, float Num2);
int main()
{
int num1 = 1;

33
Source/Library.h Normal file
View File

@ -0,0 +1,33 @@
#pragma once
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#ifdef __cplusplus
namespace Library
{
#endif
#ifdef __cplusplus
extern "C"
{
#endif
float Add(float num1, float num2);
float Divide(float num1, float num2);
float Multiply(float num1, float num2);
float Subtract(float num1, float num2);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
}
#endif

View File

@ -1,5 +1,3 @@
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(non_snake_case)]
#[no_mangle]