July 02, 2017
On 2017-07-01 21:11, Damien Gibson wrote:

> As well I only intended to use shared libraries not static ones...

Well, you can use shared libraries in two different way, dynamic linking or dynamic loading.

Dynamic linking is when you declare your external symbols as usual and you link with the shared library at build time.

Dynamic loading is when you declared your external symbols as function pointer and you don't link with the shared libraries at build time. You then use "dlopen" and the family of functions on Posix and "LoadLibrary" on Windows to load the shared library at runtime.

When using dynamic linking on Posix you link directly with the shared library. When using dynamic linking on Windows you don't link directly with the shared library but instead link with an import library, which is basically a static library (as far as I understand). I would assume that this import library has the same problem as any other static library.

When using dynamic loading you don't have to worry about these different formats at all.

You can read more about static linking vs dynamic linking vs dynamic loading and about the problems with the different formats in the dlang blog [1] and here [2].

[1] http://dlang.org/blog/2017/06/26/project-highlight-derelict/
[2] http://derelictorg.github.io/bindings/

-- 
/Jacob Carlborg
July 02, 2017
> Ahh, you need to initialise the D runtime before you call any functions that depend on it (e.g. ones that interact with the file system).
>
> declare
>     extern "C" int rt_init();
> in your c++ code and call it before ConsoleWrite and it should work.

Honestly i did try this and it didnt correct the problem... HOWEVER... I had been deleting the dll page VS and Xamarin always generate with a shared dll project as since i got dlls working with D in the first place(I was slow to figure it out) it worked just fine without the dllmain page they generated...

Placing that back in there now that weve come this far corrected the problem-> Without the need to even write rt_init in D or C++.

Thank you both very much for the help and information you guys have provided this problem is finally solved!

___________________________________________________________________________________
IF anyone happens to come across this thread in the future and has the same problem i did -> Note: Probably involving the use of Xamarin/MonoDevelop or Visual Studio with dll creation or compatibility with C++ I'd be happy to create a couple of sample projects and list the stuff it required me to install for it all to work.

I'm not going to do that at this moment as since I had to ask it seems i MAY be the only moron who seemed to have this issue? Anyway Bye everyone!
1 2
Next ›   Last »