Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd support for DllExport on Windows #7196
Comments
This comment has been minimized.
This comment has been minimized.
|
It seems that rustc-hash.dll indeed contains exports on Windows, and therefore it must be possible to somehow build such that code is exported. The following method does not produce exports; Crate:
Module:
Thoughts? |
This comment has been minimized.
This comment has been minimized.
|
|
donkeybonks
closed this
Jun 17, 2013
This comment has been minimized.
This comment has been minimized.
|
Re-opening because the general idea is still sound. Adding a Also, I'm nominating this for production ready, based on the idea that |
Aatch
reopened this
Jun 17, 2013
This comment has been minimized.
This comment has been minimized.
|
Visiting for triage; nothing to add |
This comment has been minimized.
This comment has been minimized.
|
Accepted for feature-complete |
eddyb
referenced this issue
Oct 19, 2013
Closed
Implemented a linkage attribute for functions and foreign statics. #9966
This comment has been minimized.
This comment has been minimized.
|
Assigning P-low. Not 1.0. |
pnkfelix
added
P-low
and removed
P-high-untriaged
labels
Mar 20, 2014
This comment has been minimized.
This comment has been minimized.
|
We actually dllexports all public symbols: // lib.rs
#![crate_type = "dylib"]
#![crate_id = "r"]
#[no_mangle] pub fn func1() {} // exported
#[no_mangle] fn func2() {}
pub fn func3() {} // exported
fn func4() {}
but just by accident! If we don't explicitly export anything, The "unintended export" will not occur if we add some explicit dllexports in native code: // c.c
__declspec(dllexport)
void func5(void) {}
// lib.rs
#![crate_type = "dylib"]
#![crate_id = "r"]
#[link(name = "ext", kind = "static")]
extern "C" {
pub fn func5();
}
#[no_mangle] pub fn func1() {} // exported
#[no_mangle] fn func2() {}
fn func3() { unsafe { func5(); } } // use dllexported symbol
// a.rs
extern crate r;
fn main() {
r::func1();
}
This is bad. We have to export them explicitly in this case. |
klutzy
referenced this issue
Jun 3, 2014
Closed
Need support Windows-style DLL export function names #14559
brson
referenced this issue
Aug 26, 2014
Closed
Windows: failing unit tests in libstd\unstable\dynamic_lib.rs #8818
klutzy
referenced this issue
Oct 23, 2014
Open
Unable to export unmangled dll entry points for stdcall #17806
This comment has been minimized.
This comment has been minimized.
|
I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized. This issue has been moved to the RFCs repo: rust-lang/rfcs#826 |
steveklabnik
closed this
Feb 11, 2015
This comment has been minimized.
This comment has been minimized.
|
(Note that the missing export behavior is certainly a bug, which can be fixed without introducing dllexport syntax support. I'll open new issue for the one.) |
This comment has been minimized.
This comment has been minimized.
|
Note that for MSVC targets the compiler now places I've written up a comment about this, but I'm going to use this bug to track a more proper implementation of using I think this is more concretely actionable in this repo than the RFC repo for now, so I'm going to reopen this. |
alexcrichton
reopened this
May 29, 2015
alexcrichton
added
T-tools
and removed
E-easy
P-low
labels
May 29, 2015
retep998
referenced this issue
Jun 30, 2015
Closed
[MSVC] Referencing a static from another crate doesn't seem to work #26591
This comment has been minimized.
This comment has been minimized.
|
I think we shouldn't indiscriminately put |
donkeybonks commentedJun 17, 2013
It currently does not seem to be possible to export a function from a DLL on Windows. It's not done as one would expect when building with --lib.