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 / DarkGDK, problems with libs.

Author
Message
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 6th Sep 2009 17:08 Edited at: 6th Sep 2009 17:09
For a while now I've been writing dlls for DBPro. Now I would like to port them so I could make them usable with DarkGDK.

The dll which I am currently porting, is BlitzTerrain. A LOD Terrain plugin currently only available for Dark Basic Pro, but hopefully, going to be ported to DarkGDK. http://forum.thegamecreators.com/?m=forum_view&t=145404&b=8

I got blitzterrain compiling with the Dark GDK Header file, but I am having problems. When you use blitzterrains lib with Dark GDK, It gives a few LNK4217 warnings for commands in stdlib (malloc, free, etc). The application crashes when I run it. My Question is, how do I get rid of these warnings?

Heres some code that when compiled as a lib then used in a DarkGDK project, It creates these warnings:


and heres the code:


That code doesnt crash like BlitzTerrain does, It works. I know why BlitzTerrain is crashing, and I'm working on that. I just need to know how to get rid of these warnings.

Thanks in advance!

- Kaedroho

chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 6th Sep 2009 18:05
you can either use #pragma warning ( disable : LNK4217 ) or find out what is causing it in your lib , do you also get the warning in the code for the .lib file?

chunks

nvidia geforce 9500gt + amd athlon 64
windows vista ultimate.
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 6th Sep 2009 18:07
Not for the lib file code. I have solved it though, I had this problem for months and solved it the day I decided to post about it.

Just added this at the top of the lib code.

not sure if thats what I'm meant to do but it works.

Thanks anyway.

chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 6th Sep 2009 18:11 Edited at: 6th Sep 2009 18:14
lol i never used malloc or alloc before so i dont know how they are used , when i create memory i have always used VOID *lpBits = new VOID*[ size ]; and then used delete .

Anyways glad you got it sorted.

chunks

edit: also the dba to cpp converter might come in hand for you to do this conversion , if you don`t have it its on the forum somewhere.

nvidia geforce 9500gt + amd athlon 64
windows vista ultimate.
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 7th Sep 2009 20:45
Ive converted it. BlitzTerrain has been available as a .dll since march.

Just making minor conversions to the code to make it run on GDK. I'm doing it ground up in C++ this time, the converter generated very slow code.

Mista Wilson
16
Years of Service
User Offline
Joined: 27th Aug 2008
Location: Brisbane, Australia
Posted: 8th Sep 2009 02:00
I suggest not to use that converter(dba2cpp.exe).... It generates obsfucated and weird code most of the time if you have anything more complex than a "hello world" program... there are numerous functions that it wont recognize and just "tries" to convert them, but doesnt and they end up in a commented bit of the code saying "errors" or something... and you need to port by hand anyway lol(though the converter generally destroys the functionality with its limited parsing anyway Ive found) Its a good idea, but was not finished properly ...

Good Luck, im looking forward to seeing blitzterrain in GDK

If it ain't broke.... DONT FIX IT !!!
kaedroho
17
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 8th Sep 2009 19:53 Edited at: 8th Sep 2009 19:55
Thanks, like I said, I'm currently rewriting it ground up in C++. The code which was produced by dba2cpp.exe is 40x slower than the ground up version.

I have made a working version of blitzterrain which works with GDK.

Example code:


Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 8th Sep 2009 20:42
Quote: "VOID *lpBits = new VOID*[ size ];"


That code is wrong

The size will change depending on whether the OS is 32 bit or 64 bit.

use this:

void* lpBits = new char[size_in_bytes];

OR

void* lpBits = new int[size_in_dwords];

OR

void* lpBits = malloc(size_in_bytes);

If you are creating data without a type, then the last form would be best.

When using 'new' to create an array like that, you shouldn't put the '*' at the end of the type.

eg.
THIS:
int* data = new int[size];

NOT:
int* data = new int*[size];

You can't use 'new void[size]' because 'void' has no type, and so no size.

chunks chunks
17
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: ackworth uk
Posted: 8th Sep 2009 20:52
thanks for the info i did actually write it down wrong it was supposed to be new BYTE[size]; , glad you showed me how to use malloc though .

chunks

nvidia geforce 9500gt + amd athlon 64
windows vista ultimate.

Login to post a reply

Server time is: 2024-11-20 15:19:28
Your offset time is: 2024-11-20 15:19:28