Skip to content

Instantly share code, notes, and snippets.

View retep998's full-sized avatar
🐇
Very fluffy

Peter Atashian retep998

🐇
Very fluffy
  • Massachusetts, USA
View GitHub Profile
use std::io::Read;
use std::net::TcpStream;
use std::sync::atomic::{ ATOMIC_USIZE_INIT, AtomicUsize, Ordering };
use std::thread::{spawn, sleep};
use std::time::Duration;
static COUNTER: AtomicUsize = ATOMIC_USIZE_INIT;
const NUM_SOCKETS: u32 = 10_000;
#ifdef __cplusplus
// Define operator overloads to enable bit operations on enum values that are
// used to define flags. Use DEFINE_ENUM_FLAG_OPERATORS(YOUR_TYPE) to enable these
// operators on YOUR_TYPE.
// Moved here from objbase.w.
// Templates are defined here in order to avoid a dependency on C++ <type_traits> header file,
// or on compiler-specific contructs.
//Compiled as a static library bar.lib
int bunny = 273;
int rabbit() { return 273; }
__declspec(dllexport) int bunny = 273;
__declspec(dllexport) int rabbit() { return 273; }
@retep998
retep998 / bar.c
Last active August 15, 2016 23:02
int bunny = 273;
int rabbit() { return 273; }
@retep998
retep998 / Guide.md
Last active December 26, 2020 03:50

Installing OpenSSL for Rust on Windows with MSVC

When using MSVC Rust on Windows, everything typically works out of the box, up until you decide to do some web stuff with hyper. Suddenly a new dependency, openssl, is failing to build and you have no idea how to fix it. Fortunately this guide is here to save you!

WARNING: OpenSSL 1.1 support was only added in openssl-sys = "0.9". Older versions only support up to OpenSSL 1.0.2. sfackler/rust-openssl#452

  1. First you will need to download and install OpenSSL itself. You can download an installer from http://slproweb.com/products/Win32OpenSSL.html. In particular you want the newest version and not the light version. Make sure it matches the version of Rust you have, if you're using x86_64-pc-windows-msvc you will want Win64, and if you're using i9686-pc-windows-msvc you will want Win32. For the purpose of example I have installed Win64 OpenSSL v1.0.2h.
  2. If all went well you should now have OpenSSL installed somewh
C:\Users\Peter\.multirust\toolchains\nightly-x86_64-pc-windows-gnu\bin> dumpbin .\rustc.exe /headers
Microsoft (R) COFF/PE Dumper Version 14.00.23918.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file .\rustc.exe
PE signature found
File Type: EXECUTABLE IMAGE
@retep998
retep998 / foo.c
Created March 31, 2016 09:51 — forked from sargun/foo.c
int pants() {
char *foo = crud();
printf("Crud: %s\n", foo);
rust_free(foo);
}
@retep998
retep998 / spec.md
Last active November 2, 2015 21:56
Contextual overload language spec

##Identifiers## Identifiers are any valid sequence of one or more unicode characters not including whitespace or the symbols */=. Indentifiers consisting entirely of digits will often be contextually understood to represent their numerical value, although depending on context they might mean something else. Case sensitivity is contextual.

##Comments## Comments are done by using tabs and last until either the end of the line or another tab

##Statements## Statements are of the form

identifier = expression
@retep998
retep998 / #llvm
Last active October 26, 2015 18:32
stdcall
(1:56:14 PM) Retep998: I'd still really like a calling convention for stdcall methods because they aren't the same as stdcall functions
(1:56:21 PM) Retep998: who should I talk to about getting something like that?
(2:02:40 PM) jroelofs: Retep998: rnk maybe?
rnk rnsanchez
(2:03:27 PM) Retep998: rnk: Someone said I should talk to you about stdcall calling conventions
(2:04:49 PM) jroelofs: it might help to describe what you think is different between the two
(2:05:21 PM) Retep998: How values are returned from stdcall functions differs from stdcall methods
(2:05:40 PM) Retep998: Like if I return a struct containing two 32-bit integers
(2:06:04 PM) Retep998: fn foo(self) -> ThatType
(2:06:39 PM) Retep998: the stdcall calling convention currently does the function style, but to get the method style I have to use a hacky workaround to get it right