Re: D and .lib files. C++/Other?

2017-07-02 Thread Damien Gibson via Digitalmars-d-learn
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

Re: D and .lib files. C++/Other?

2017-07-02 Thread Jacob Carlborg via Digitalmars-d-learn
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

Re: D and .lib files. C++/Other?

2017-07-02 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 2 July 2017 at 05:33:45 UTC, Damien Gibson wrote: K im retarded... So I forgot the golden rule, debug libs with debug app, release libs with release app.. I attempted loading the debug version of dll with D again just to see what kinda errors (may) come up there, sure enough there

Re: D and .lib files. C++/Other?

2017-07-01 Thread Damien Gibson via Digitalmars-d-learn
K im retarded... So I forgot the golden rule, debug libs with debug app, release libs with release app.. I attempted loading the debug version of dll with D again just to see what kinda errors (may) come up there, sure enough there is and i get a fairly detailed one... However, when the

Re: D and .lib files. C++/Other?

2017-07-01 Thread Damien Gibson via Digitalmars-d-learn
Well I ended up getting it to compile finally by adding extern "C" before the function imports on C++ side (Again i added the extern(C) to D side) however i still end up not being able to run the program as it keeps telling me: 0xC005: Access violation reading location 0x Ive

Re: D and .lib files. C++/Other?

2017-07-01 Thread Damien Gibson via Digitalmars-d-learn
If you're wanting to use the names (e.g. "ConsoleWrite") as is on the C++ side them you need to declare them extern(C++) ( or extern(C)) on the D side. if you were to run whatever the equivalent of "nm my.dll | grep Console" on windows on the dll then you'd see the two symbols with a different

Re: D and .lib files. C++/Other?

2017-07-01 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 1 July 2017 at 20:47:55 UTC, Damien Gibson wrote: Well I finally somehow got it to stop complaining about a bad lib file, but now it wants to tell me the entry point for the functions i list isnt correct, so now im just unsure if its being stupid on me or im not writing something

Re: D and .lib files. C++/Other?

2017-07-01 Thread Damien Gibson via Digitalmars-d-learn
Well I finally somehow got it to stop complaining about a bad lib file, but now it wants to tell me the entry point for the functions i list isnt correct, so now im just unsure if its being stupid on me or im not writing something write on the D or C++ end... The D code:

Re: D and .lib files. C++/Other?

2017-07-01 Thread Damien Gibson via Digitalmars-d-learn
Not sure if this is the issue you're having, but if you're using .lib files on Windows, note that DMD, the D compiler, will by default, on 32bit, output a format (OMF) that is not compatible what Visual Studio is using (COFF). For 64bit, DMD outputs COFF .lib files. For 32bit, use the

Re: D and .lib files. C++/Other?

2017-07-01 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-07-01 20:13, Damien Gibson wrote: Hi... A while back i had some issues with making a usable dll file, to which i did manage to figure out... Though while trying to use it with C++ i kept getting an error about a corrupted lib file... Not sure if this is the issue you're having, but if

Re: D and .lib files. C++/Other?

2017-07-01 Thread Damien Gibson via Digitalmars-d-learn
Note: I am only on windows as well so i have no idea if the issue remains the same for Linux and it may be a windows specific issue? Also I was using Visual Studio 2013 C++ so i have no idea if its limited to issues there either, I'm on super slow internet (Not dialup but might as well be) So