Re: How to call a function from a dll created with d ?

2022-07-03 Thread frame via Digitalmars-d-learn
On Sunday, 3 July 2022 at 12:54:45 UTC, kinke wrote: On Sunday, 3 July 2022 at 08:15:38 UTC, frame wrote: Are you sure? 100%, just try yourself. Why would the symbol be defined in the executable? `dimedll.d` isn't compiled into the executable. The code is using Phobos std.stdio.writeln

Re: How to call a function from a dll created with d ?

2022-07-03 Thread kinke via Digitalmars-d-learn
On Sunday, 3 July 2022 at 08:15:38 UTC, frame wrote: Are you sure? 100%, just try yourself. You import `testFunc` as normal import, the compiler ignores `pragma(lib)` - that's only for the linker which will ignore it too since the symbol is already in your executable. Why would the symbol

Re: How to call a function from a dll created with d ?

2022-07-03 Thread frame via Digitalmars-d-learn
On Saturday, 2 July 2022 at 20:43:41 UTC, Vinod KC wrote: But I got this error message. dime.obj : error LNK2001: unresolved external symbol __D7dimedll12__ModuleInfoZ dime.exe : fatal error LNK1120: 1 unresolved externals Error: linker exited with status 1120 I tried the -H switch. You

Re: How to call a function from a dll created with d ?

2022-07-03 Thread frame via Digitalmars-d-learn
On Saturday, 2 July 2022 at 14:06:03 UTC, kinke wrote: With LDC, this is sufficient for this trivial example: ```d module dimedll; export void testFunc() { // export only needed when compiling with `-fvisibility=hidden` import std.stdio; writeln("This is from dll"); } ``` `ldc2

Re: Importing module from the perspective of submodule.

2022-07-03 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 3 July 2022 at 05:40:30 UTC, BoQsc wrote: Is it possible to import module that is not in the module's current directory's folder or subfolders? For example: I want to import `somemodule2.d` and `somemodule3.d` into a **`somemodule.d`** **.\somefolder\somemodule.d**