Comments (5)
Thanks for posting your experience with this! I have two questions with it, which I haven't looked into the detail. IIRC, generating .def files for the executable is brittle in that the executable can't be renamed - is that still the case? The other issue is data symbols (which we use for OCaml) - does this still only work for functions?
from flexdll.
Thanks for posting your experience with this! I have two questions with it, which I haven't looked into the detail. IIRC, generating .def files for the executable is brittle in that the executable can't be renamed - is that still the case?
You mean if a dll is linked to an exe, for example. b.dll
is linked to a.exe
(the b.dll
will loaded by running a.exe), I can't rename the a.exe
to x.exe
?
My guess is this is correct, but I haven't tried it.
The other issue is data symbols (which we use for OCaml) - does this still only work for functions?
I haven't tried it, so I can't say whether some data symbol(for example, the global variable) can be shared, I will tried it.
In my test, the C function and C++ function can be exported by exe, and later be called from the dll.
from flexdll.
The renaming part is the "killer" requirement (albeit subtly) for how FlexDLL is used in OCaml. In this case, we need DLLs which can be loaded by any executable (via LoadLibrary
) and can access symbols from the main executable, regardless of its name. Before FlexDLL (if I remember correctly - it's a long time ago!) OCaml on Windows put the runtime into a DLL with a fixed name precisely so this could "work".
The Windows loader expects all the symbols in the DLL being loaded to be resolved by import libraries specified in the DLL only - FlexDLL extends that to allow the symbols to come directly from what's already running with the need to specify the import libraries (which makes the behaviour closer to dlopen
). You can of course emulate that entirely in code with a registration API - flexlink makes it slightly more efficient by rewriting the code pages with the actual locations (so it removes the pointer indirections, just like the loader does).
from flexdll.
Thanks for posting your experience with this! I have two questions with it, which I haven't looked into the detail. IIRC, generating .def files for the executable is brittle in that the executable can't be renamed - is that still the case?
You mean if a dll is linked to an exe, for example.
b.dll
is linked toa.exe
(theb.dll
will loaded by running a.exe), I can't rename thea.exe
tox.exe
?My guess is this is correct, but I haven't tried it.
I have just tested it, and I can change the exe file name, and when I run the exe file, the dll file can still be loaded correctly, and it can call the function inside the exe. This means the "rename" feature is OK in my method.
from flexdll.
The other issue is data symbols (which we use for OCaml) - does this still only work for functions?
I haven't tried it, so I can't say whether some data symbol(for example, the global variable) can be shared, I will tried it. In my test, the C function and C++ function can be exported by exe, and later be called from the dll.
I have just tested it. I can correctly export a global variable from the exe, and the dll can access the global variable.
So, I think the exported feature from exe file works correctly for both functions and variables.
from flexdll.
Related Issues (20)
- Cannot relocate on OCaml 4.13.1 [Windows] HOT 1
- Implementing a less memory intensive read function HOT 9
- Temporary files not deleted on exit HOT 3
- findlib sometimes cannot be built on Windows HOT 3
- Support for /alternatename: linker directive needed for x86 HOT 2
- Fix parallel access to global symbol structures
- flexlink: simplify static linking with libstdc++
- Upgrade from msvcrt.lib to ucrt.lib HOT 6
- ** Fatal error: Cannot parse directive: -exclude-symbols:__alloca
- Compile ERROR with MSVC VS2019 HOT 3
- Fail to find a function in the executable (pg_query) HOT 5
- Conditionally link with gcc_eh
- MSYS2/ucrt64 support HOT 2
- Cannot resolve symbols for swscanf
- Switch to Unix.create_process for auxiliaries
- MSVC flexlink appears to attempt cygpath
- Issue with link order of archive files specified twice on the command line HOT 11
- "Cannot relocate" error with flexdll in OCaml for Windows 4.11 (and older versions) HOT 8
- `-print-search-dirs` may return `;`-delimited mixed paths on MSYS2 HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flexdll.