Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / .NET support for DarkGDK 2.0 planned for RC5

Author
Message
Mistrel
Retired Moderator
13
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 12th Jun 2012 02:59
I've been working very closely with Diggsey on implementing a .NET solution for RC5. He's also putting together some nice little treats for you guys in addition to basic language support. But I'll let him tell you more about it.

Olby
15
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 12th Jun 2012 03:07
Excellent news! Thumbs up for Diggsey and Mistrel of course. Thanks guys, eagerly waiting for RC5.


Intel Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP2, PureBasic 4.61 + DarkGDK 2.0
Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 12th Jun 2012 03:09 Edited at: 14th Jun 2012 16:26
The .net language support comes in two parts:

- The first parts works just like other languages supported by DarkGDK - a language plugin is provided which generates the code to give you direct access to all the normal DarkGDK commands from any .net language. You can add plugins and regenerate this code to fully customize the engine.

- The second part acts as a wrapper around the standard commands, proving an object oriented interface to DarkGDK. Currently all the built in commands have been added to this wrapper, as well the cloth and particles, and advanced terrain plugins. This wrapper uses the same class names as DarkGDK.net did where possible, but some of the method names have changed.

Additional features:
- GDKForm and GDKControl classes which can be used with the visual studio form designer.
- The wrapper classes won't break if you use DarkGDK commands directly, so you can mix and match to get the best ease of use.
- A project template which sets you up so that you can just start typing in commands as you would with DBPro.
- Supports .net 2.0 and later.

[b]
Dar13
11
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 13th Jun 2012 03:21
I realize that .NET support would be great, but are you sure that you should introduce this feature in a Release Candidate? Why not just wait until the next update and polish the .NET support and the BASIC support without the pressure of getting this product to market?

P.S. .NET support is great! I'm seriously considering using DarkGDK for my next project.

Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 13th Jun 2012 03:55 Edited at: 13th Jun 2012 03:57
Quote: "I realize that .NET support would be great, but are you sure that you should introduce this feature in a Release Candidate? Why not just wait until the next update and polish the .NET support and the BASIC support without the pressure of getting this product to market?"


Mistrel is working on DarkGDK and I'm working on .net support. As long as neither of us is held back waiting for the other then .net support won't delay the release. There are also benefits - any bugs are sure to be picked up by at least one of us. Although more time is spent fixing bugs, the result will be a much more stable product.

For those who are interested, here's a look at the main loop from a C# program using the wrapper classes with DarkGDK, I'm sure you can work out what it does!


This program automatically handles the loss of the d3d device with no extra code in the main loop. It's as simple as adding an event handler to reload the media:


To achieve the same thing in DBPro or GDK 1 you'd have to create an image and then keep checking if the image exists to detect when the device is reset.

[b]
Dar13
11
Years of Service
User Offline
Joined: 12th May 2008
Location: Microsoft VisualStudio 2010 Professional
Posted: 13th Jun 2012 04:02 Edited at: 13th Jun 2012 23:47
Quote: "Mistrel is working on DarkGDK and I'm working on .net support. As long as neither of us is held back waiting for the other then .net support won't delay the release. There are also benefits - any bugs are sure to be picked up by at least one of us. Although more time is spent fixing bugs, the result will be a much more stable product."

Ok. I was just wondering because usually a release candidate is feature-frozen.

Mistrel
Retired Moderator
13
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 13th Jun 2012 06:25 Edited at: 13th Jun 2012 06:39
Quote: "I realize that .NET support would be great, but are you sure that you should introduce this feature in a Release Candidate? Why not just wait until the next update and polish the .NET support and the BASIC support without the pressure of getting this product to market?"


DarkGDK 2.0 is designed to be portable. By working with Diggsey on supporting .NET we've been able to further stability and improve DarkGDK's ability to mesh well with other languages. Adding a new language is what DarkGDK 2.0 is designed to allow; if there is a problem which inhibits this then I want it addressed in the release candidate where it will be easier to hammer it out.

There will be several changes in RC5 which will require very minor modifications to existing code but these were the result of addressing issues which did not present themselves until we began adding support for .NET. These changes were to address portability and ease of use across languages not to add new features.

While I agree that RC typically means a general freeze on the code base, there wasn't a whole lot of people testing the software at the time it entered release candidate status. Although the software is stable and ready for commercial use, the feature set is still in a bit of flux to accommodate reports from testers. This is a major release and due to its complexity I want to make absolutely sure that the final version is has been thoroughly tested, fully functional, and provides an adequate cross-language experience.

ravensan
7
Years of Service
User Offline
Joined: 11th May 2012
Location:
Posted: 13th Jun 2012 06:53
Great to hear about the the OOP and .Net support. I'm looking forward to it.

"imagination is more important than knowledge" -- Albert Einstien.
FlexiCat
9
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 13th Jun 2012 16:24
This is nice work guy, i like that a OOP system is implemented into it rather then just possible.

If you are interested in making DarkGDK more cross-language compatible perhaps there is a way to better support importlib .lib files.

For example with the D language, i can run this program implib on the gdkengine.dll and get a simple .lib file and all i have to do now is in the top of my main.d file is define "bool InitDarkGDK()" as an "extern(C)" function and then compile the main.d and .lib file together and intializing DarkGDK works. its really really simple and avoids the need to use GetModuleHandle and LoadLibrary and all that but still requires and uses gdkengine.dll just with a lot less hassle. Especially for D (and i am sure others) there are some complex work-rounds i am having to do to make things simple and at the moment i am stuck on a problem because GetModuleHandle doesn't seem to function properly or something.

As far as i understand it though the gdkengine.dll is a kind of set of nested .dlls in one. Perhaps there is a way to make importlibs work from the top gdkengine.dll and read all functions of subsequent dlls because if it could the entire import libraries made by build libs could be literally one or two liners per function, that is it would need to use two lines if using paramsListAlt thus reordering the arguments so the function in D would just be a pass through function.

Now i may be rambling about something impossible or too difficult to ever do but it would be so great and make porting so easy.

I swear to the programmers bible that I shall not harm the FPS.
Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 13th Jun 2012 18:00
Given that the code which is calling GetModuleHandle() and the like is all auto-generated I don't really see why it's any more hassle to use one over the other? Most of the code in each function would still be necessary with implib, and it's code you never even have to look at.

[b]
madmunkey
7
Years of Service
User Offline
Joined: 9th May 2012
Location: United Kingdom
Posted: 13th Jun 2012 22:18
This is grate news too bad it's not on the DarkGDK.NET forum

Can't wait to see this and finally have some good documentation and guides!

Is there any planned release date for this?
FlexiCat
9
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 14th Jun 2012 09:18 Edited at: 14th Jun 2012 10:45
Quote: "Given that the code which is calling GetModuleHandle() and the like is all auto-generated I don't really see why it's any more hassle to use one over the other? Most of the code in each function would still be necessary with implib, and it's code you never even have to look at."


True i forgot about the whole gdk wait function stuff so not so much less code for the wrapper, however the GetModuleHandle method just isn't working for me with D though i was able to grab the plugin .dlls that gdkc uses and implib them and statically link it and it worked (up until my D version of simpleWindow died but that's a different matter) where the GetModuleHandle method failed to work (by that i mean it does nothing and just stops) and while i believe that D's GetModuleHandle does work and it is infact something i am doing wrong or missing there is so little documentation on it and fewer people who have been able to help i have not been able to get it to work where the implib method worked instantly.

EDIT: doing this also means that the wrapper can be compiled once into a .lib itself into a common location and provide .di files that any D DarkGDK project would import(include) and compile the project with the DarkGDKD.lib and it will work without having to compile the wrapper .d files alongside your projects code. This is a familiar thing for D wrappers for example Derelict works in this manor and doing so is a more "D" way of doing it rather then a rather c/c++ way of making it work.

I swear to the programmers bible that I shall not harm the FPS.
Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 14th Jun 2012 14:09 Edited at: 14th Jun 2012 14:10
Quote: "EDIT: doing this also means that the wrapper can be compiled once into a .lib itself into a common location and provide .di files that any D DarkGDK project would import(include) and compile the project with the DarkGDKD.lib and it will work without having to compile the wrapper .d files alongside your projects code. This is a familiar thing for D wrappers for example Derelict works in this manor and doing so is a more "D" way of doing it rather then a rather c/c++ way of making it work."


Both C++ and D allow you to compile the code to a DLL and a .lib file regardless of which method you use. If you want you could send me some of the generated code where GetModuleHandle isn't working and I'll see if I can spot anything that might be causing a problem.

[b]
FlexiCat
9
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 14th Jun 2012 15:41 Edited at: 14th Jun 2012 15:42
I know that you can do it either way with C++ and D but the fact that other popular wrappers for D are distributed and used in this way i would like to provide the most common method as well.

I believe many of my problems come from my use of templating with D in order to call the DarkGDK functions.

My idea was to have a template that is given the return type, loadPtr, noSafeCall etc and the arguments that you pass to the loaded dll function and that way each wrapped function would be much smaller using this template.



And for an example usage here are two:


Note those two functions are made by the current, not complete or ready, version of gdk_dlang.dll that buildlibs uses so there may be issues in them.

The idea here was to reduce the amount of code in each wrapped function (and thus the language plugin requires less complexity to write a function) by using a template. Because i am having an issue and finding it hard to debug i am re-writing the language plugin to not use a templates now, might have a version done tonight or tomorrow for testing so long as i can get my simpleWindow.d to work.

While i know things can be made to work as they are i believe if your going to write a wrapper for another language you should provide that wrapper in a way that is common to that language.

Either in the wrapper code as you have done with oop support in the .net wrapper, or in the use of the wrapper like i mentioned that it seems the .lib with accompanying .di files are the standard or common way to do so in D.

I swear to the programmers bible that I shall not harm the FPS.
budokaiman
FPSC Tool Maker
10
Years of Service
User Offline
Joined: 24th Jun 2009
Playing: Hard to get
Posted: 14th Jun 2012 16:18
Excellent news. One question however, will this only be compatible with Visual Studio, or should it work with other IDE's as well? I'm particularly interested in using it with SharpDevelop.


3DS friend code: 0044-2895-5474
Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 14th Jun 2012 16:22 Edited at: 14th Jun 2012 16:27
Quote: "I know that you can do it either way with C++ and D but the fact that other popular wrappers for D are distributed and used in this way i would like to provide the most common method as well."


What I'm trying to say is that the way GDK works is not incompatible with what you want. GDK already comes in a form suitable for making a .lib and .dll. Whether it uses GetModuleHandle or not doesn't affect that.

Have you tried adding "extern(C)" to the function pointer type declaration?

@budokaiman
.net support is provided by generating the necessary c# source files and then compiling them to a .dll (a special program which does the compilation is supplied, so you don't even need to have a c# compiler installed). Once it has been compiled to a .net DLL, you can use it from any .net language with any IDE just as easily as if it had been written in that language. All that is required is .net 2.0 or later (.net 3 comes pre-installed on all versions of windows since windows vista).

[b]
FlexiCat
9
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 14th Jun 2012 16:59
Suitable for making the wrapper that comes from buildlibs into a .lib yes but not making the wrapper out of a .lib attained by using implib on gdkengine.dll as all that is exposed is InitDarkGDK. Providing the wrapper as a .lib i understand has nothing to do with that i muddied my communications a bit. I would like to provide the D wrapper as a .lib yes but i would also like that wrapper to be able to use a .lib of the gdkengine.dll but maybe it will all just work when i finish making my language plugin not use the template. Its just the D method of using a .lib for a dll is easier and i can get that to work without further documentation however the GetModuleHandle has failed previously and i need more documentation that is not apparently available so i must rely on the #d irc to have people willing to look over my template and have the knowledge/patiance required to assist.

extern(C) may help actually will have to look into that, thanks.

I swear to the programmers bible that I shall not harm the FPS.
Mistrel
Retired Moderator
13
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 14th Jun 2012 17:47 Edited at: 14th Jun 2012 17:50
FlexiCat, what you're asking is not possible with the modular approach DarkGDK 2.0 offers. You're asking for a single interface for all of the engine commands; this simply isn't possible considering the fact that the engine itself is customizable.

What you CAN do is compile a second dll with all of the exports you've build using the buildlibs tool. This is what Diggsey has done with his implementation for .NET support.

Howewer, this simply doesn't make a whole lot of sense considering the features provided by generating the header with the language plugin. For example, you would lose optional parameters and polymorphic function overrides unless you did something really fancy like export a second header to be used with your second dll..

Although Diggsey does generate a second dll (which is optional), I do believe .NET is an exception because it already knows how to handle this type of scenario. I presume this to due to the nature of the CLR and working with .NET assemblies. D is a compiled language and does not receive the same benefits as a virtual machine-based language.

I do not know C# or .NET so Diggsey would be the one to clarify any of this.

FlexiCat
9
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 14th Jun 2012 18:31
Thats all i wanted to know if there way any way to simple take a import lib out of the gdkengine.dll, as i said in the first place i thought this would probably be impossible and so it is. I know i can compile the wrapper as a dll aswell i just thought that being able to take the lib right from the gdkengine could be helpful too however as it is not possible that's perfectly fine aswell, i wasnt trying to be complicated or anything so sorry if i seemed that way.

Thanks Mistrel.

I swear to the programmers bible that I shall not harm the FPS.
Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 14th Jun 2012 18:35 Edited at: 14th Jun 2012 18:38
Quote: "Suitable for making the wrapper that comes from buildlibs into a .lib yes but not making the wrapper out of a .lib attained by using implib on gdkengine.dll as all that is exposed is InitDarkGDK."


What I was suggesting is making a second DLL like mistrel said. I know that in C++ this is as simple as taking the .cpp files generated by the language plugin, adding the dllexport attribute to the functions and then compiling them into a .dll. There will be something very similar to this for D I'm sure. The language plugin is essential though because without it the engine cannot be customized.

This is effectively what my .net language plugin does - it compiles the c# files generated by the language plugin to a .dll. It also packs gdkengine.dll inside that DLL so you still only need a single .dll. A .net DLL has the benefit that header files are unnecessary because all the meta-information needed to access the content of the DLL is also stored inside the .dll itself.

edit:
Quote: "Thats all i wanted to know if there way any way to simple take a import lib out of the gdkengine.dll, as i said in the first place i thought this would probably be impossible and so it is. I know i can compile the wrapper as a dll aswell i just thought that being able to take the lib right from the gdkengine could be helpful too however as it is not possible that's perfectly fine aswell, i wasnt trying to be complicated or anything so sorry if i seemed that way."


Ah, sorry I get what you're saying now. Yes it's not possible to do it directly from gdkengine.dll as the other dlls are compressed inside it, and only the dll itself knows how to unpack them.

[b]
FlexiCat
9
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 14th Jun 2012 18:43
Originally when i was talking about an import library for the dll i meant a .lib built from gdkengine.dll that i can make the language plugin with but as i thought and Mistrel confirmed this just isn't possible. I know i can make the end product (after buildlibs) wrapper into a dll as well and make an import lib like that but then there are two dlls just to use one. I have never looked into placing a dll inside another, i wonder(tangent, sorry) how it is done in D if the surface dll is D and the inner is C. But either way i don't need to know that just to get the wrapper to work at all, its slow going as i have little spare time at the moment.

I swear to the programmers bible that I shall not harm the FPS.
Seppuku Arts
Moderator
14
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 14th Jun 2012 21:23
This is excellent news, I'll be sure to test it out once you've got it released. I was almost tempted to pick up Dark GDK.NET, but knowing 2.0 will be coming with it .NET support I will be sure to wait and buy it when it's ready. I am a great lover of C# and Dark Basic, so I'd say that I'm won over by the fact it's supported.

FlexiCat
9
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 15th Jun 2012 15:31
Speaking of language dlls, how do you build the stock ones. In making my own i decided to try and compile your stock cpp language dll provided in DarkGDK/SDK/... etc but i cannot get it to work when buildlibs runs it it just crashes so i compiled a debug version and i get this error.



Do you have a build script or makefile for it i can go over? At the moment i am just using vc08 and started a blank project set for dll and added your files into that and compiled, it worked for my python based dll with build libs.

I swear to the programmers bible that I shall not harm the FPS.
Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 15th Jun 2012 18:21
The stock one currently doesn't compile with VC++, some of the .cpp files rely on some non-standard behaviour of the G++ STL. Extract the attached zip to your "DarkGDK\sdk\include" folder and it should work.

[b]

Attachments

Login to view attachments
FlexiCat
9
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 15th Jun 2012 21:02
Awesome diggsey that worked a charm, thanks.

I swear to the programmers bible that I shall not harm the FPS.
madmunkey
7
Years of Service
User Offline
Joined: 9th May 2012
Location: United Kingdom
Posted: 16th Jun 2012 13:01
What the plan for people who own DarkGDK.NET? having only brought it a month ago to find out it is really buggy with little documentation DarkGDK.NET v2 is going to be a must upgrade for me but I'm only a hobbyist who wants to play around.
Boudreau
9
Years of Service
User Offline
Joined: 19th Feb 2010
Location: NB, Canada
Posted: 19th Jun 2012 20:06
Same here. DarkGDK.NET is such a struggle. When Blitzwerks Terrain came out for DarkGDK, I jumped on this opportunity. I didn't realize that it wasn't compatible with the .NET. DarkGDK.NET is a dead end for features expansion. Two bad investments at the time on my part.



Can't wait to see 2.0 running on VB with Blitzwerks. Hopefully I will see a return for my buck with a free upgrade.
madmunkey
7
Years of Service
User Offline
Joined: 9th May 2012
Location: United Kingdom
Posted: 26th Jun 2012 21:49
Will there be a trial version of this we can try?
FlexiCat
9
Years of Service
User Offline
Joined: 15th Jun 2010
Location:
Posted: 27th Jun 2012 00:21
i doubt there will be a trial version of RC5 before it gets released, unless you mean a trial version of RC5 same as there is already for RC4... Then i would assume yes just when it gets done.

Cant be too long till RC5 is out though right Mistrel? or am i so wrong?

I swear to the programmers bible that I shall not harm the FPS.
madmunkey
7
Years of Service
User Offline
Joined: 9th May 2012
Location: United Kingdom
Posted: 27th Jun 2012 08:37
I meant would there be a trial of the .net part
Olby
15
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 27th Jun 2012 13:37
Quote: "I meant would there be a trial of the .net part"


In line with previous releases I suppose you'll get all supported languages in one bundle. GDK 2.0 generates all necessary headers if the language is supported, so there is no separate installations for them. Just wait until the RC5 is released. In RC4 you can generate headers for C++ and PureBasic.


Intel Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP2, PureBasic 4.61 + DarkGDK 2.0
haliop
10
Years of Service
User Offline
Joined: 2nd Sep 2008
Location:
Posted: 3rd Jul 2012 19:40
when is this coming out? i cannot compile.. date expried... comeon mistrel dont leave us hanging.
haliop
10
Years of Service
User Offline
Joined: 2nd Sep 2008
Location:
Posted: 4th Jul 2012 14:32
please respond.
aerostudios
10
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 4th Aug 2012 01:40
@Diggsey, any news on a release date yet? I am anxious to get my TOWER CAB ( www.towercab.com ) game going with this toolset. I used the previous DarkGDK.NET for Airline Sharks, but could not make use of my complete set of DBPro plugins. So I am really anxious to get my hands on your .NET solution. Thanks.!

Russell B. Davis/aerostudios
Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 4th Aug 2012 04:05
I'm waiting to hear from Mistrel when RC5 will be released.

[b]
FireIndy
12
Years of Service
User Offline
Joined: 17th Jan 2007
Location: US of A
Posted: 4th Aug 2012 06:07
If it is really "easy" to switch from 2.0 from 1.0, I will switch over. My project is growing kind of large now lol. Anyways, I can't wait for this! Especially the DirectX device lost problem being so easy to catch now. I'm still having issues with that in 1.0.

Great work!

aerostudios
10
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 17th Aug 2012 22:50
I don't know about anyone else, but I have to get my project done. I may have to give up on any VB.NET use of the DarkGDK until much later when my livelyhood isn't depending upon it. Time is wasting...

Russell B. Davis/aerostudios
Rudolpho
13
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 17th Aug 2012 23:25
A thought recently struck my mind... if we're not supposed to spread our gdkengine.dll files (which makes sense, by all means) how are you supposed to release anything made in DGDK2?
It sounds like the library will end up out there sooner or later and with the old RC demo wrapper source files ready to plug and play, or am I missing something?


"Why do programmers get Halloween and Christmas mixed up?"
Seppuku Arts
Moderator
14
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 18th Aug 2012 00:42
Anybody actually heard from Mistrel? Or have contact with him? It has been a while since there's been any kind of update. Seems a bit odd that he's disappeared out of the blue.

Juggernaut
7
Years of Service
User Offline
Joined: 12th Mar 2012
Location:
Posted: 18th Aug 2012 21:46
@Seppuku Arts: He can be ill. Or maybe he is deep in his work. No time to forum.

Login to post a reply

Server time is: 2019-07-16 09:35:14
Your offset time is: 2019-07-16 09:35:14