update load dynamic library test for std lib changes

This commit is contained in:
Andrew Kelley 2019-05-29 23:45:28 -04:00
parent 8eaf1387c7
commit 8ca294c430
No known key found for this signature in database
GPG Key ID: 7C5F548F728501A9
2 changed files with 5 additions and 4 deletions

View File

@ -108,11 +108,12 @@ pub const LinuxDynLib = struct {
const fd = try os.open(path, 0, os.O_RDONLY | os.O_CLOEXEC);
errdefer os.close(fd);
// TODO remove this @intCast
const size = @intCast(usize, (try os.fstat(fd)).size);
const bytes = try os.mmap(
null,
size,
mem.alignForward(size, mem.page_size),
os.PROT_READ | os.PROT_EXEC,
os.MAP_PRIVATE,
fd,

View File

@ -1,12 +1,12 @@
const std = @import("std");
pub fn main() !void {
const args = try std.os.argsAlloc(std.debug.global_allocator);
defer std.os.argsFree(std.debug.global_allocator, args);
const args = try std.process.argsAlloc(std.debug.global_allocator);
defer std.process.argsFree(std.debug.global_allocator, args);
const dynlib_name = args[1];
var lib = try std.DynLib.open(std.debug.global_allocator, dynlib_name);
var lib = try std.DynLib.open(dynlib_name);
defer lib.close();
const addr = lib.lookup("add") orelse return error.SymbolNotFound;