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.

DLL Talk / Can't seem to make no-param no-retun commands

Author
Message
Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 30th May 2008 22:42 Edited at: 30th May 2008 23:02
I have been working on a plugin for a while, and the user has to call the initialization command, which has no parameters and returns void.

I've tried many ways in the string table to represent this, but all the ways I've tried, DBP has refused to understand what I mean.

here are the things I've tried so far:


etc.

Using the first one, DBP says "can't find '?initializeSystem' in 0:dbprocore.dll"
Using the second, DBP says "parameter mismatch"
Using the third, DBP says "could not understand command at line #"



Any help?



hold on a minute... initializeSystem returns an integer... o.O easy fix for the stringtable...

EDIT: oh snap, now it says "can't determine parameter type" when i use the following entry


!!

EDIT: hmmm. it seems i've merely forgotten the paren.s in DBP.

EDIT: Well, now it seems to be looking in dbprocore.dll instead of MY dll, wherein the stringtable that holds the entry can be found.

It compiles, runs, but when it hits the command IAC ALLOCATE RUNTIME FUNCTIONS() it says "cannot find function '?initializeSystem' in 0:dbprocore.dll"

wtf?!

EDIT: I wasn't supposed to put a ? before a function when I use extern "C". So that's fixed now, my error handling in the DLL command has caught something shiny for me to look at and now I must fix that instead.

so... LoadLibrary is failing on me. ?


I copied this method straight from my other experimental DLL which I got working with some help o.O

IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th May 2008 23:33
Your very first resource string is the correct format, but the function name looks very wrong. After the function name there should be one or more @ symbols followed by a few letters. But you seem to have fixed that by exporting the function as 'extern "C"'.

You latest error may be that the DLL you are trying to load hasn't been included in the compiled EXE by the DBPro compiler. Try adding a 3D command to your code somewhere - it doesn't have to be executed, but only needs to be present.

Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 30th May 2008 23:44 Edited at: 30th May 2008 23:59
aha you is genius

I assumed DBP always included all of the libraries with every executable, and that's why they were >5mb, and that's also why 6.8 allows the user to pick and choose which plugins he wants to include.

EDIT: what causes a float-returning function to return "-1.#IND"? that is what I see when I call one of my float-returning commands and then use the str$() command to write it on the screen. is this the kind of cast I should be using for returning a float (lastRayCast.Direction.x is a float)?

however it may just be my math sucking

IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 31st May 2008 00:13
Quote: "you is genius"

I do believe I already knew that

Just to help you out a little further, you can have your DLL instruct the compiler on exactly which DLLs you need for it to include when compiling:


The only thing you need to do to add new DLLs to the list, is add them to the 'Dependencies' array. The compile-time sizeof operator takes care of the rest automatically.

Your code for returning a float looks Ok, but you also need to make sure that your function is returning a DWORD and not a float.

Image All
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 31st May 2008 00:15
Indeed it is, it must just be sucky math

Login to post a reply

Server time is: 2024-02-28 19:42:53
Your offset time is: 2024-02-28 19:42:53