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 / How to access DBPro objects and functions from Plugins?

Author
Message
finalherizo
9
Years of Service
User Offline
Joined: 20th Jul 2010
Location:
Posted: 20th Jul 2010 09:37
Hello to all!
Sorry for my bad english, I know how to create simple plugins (like in the technical documentation). Now I am wondering how to access BDPro objects and functions from plugins (sprites, meshes,...).

Thanks in advance.
Clonkex
Forum Vice President
9
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 18th Aug 2010 04:12
Hmm....yes me too, but I'm still stuck on how to get the simple plugins working.....I'm using VC++ 2008 Express. Could you help?

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Aug 2010 15:47
I guess there's a new generation of plug-in writers coming along...

I've got a load of notes that I've assembled over time for things that work for me and I'm planning on tidying them up and posting them somewhere.

While you wait for that, I'll put together a simple example for you tonight and post it here.

MikeRK
9
Years of Service
User Offline
Joined: 18th Aug 2010
Location: United Kingdom
Posted: 18th Aug 2010 16:35
I would also be interested in this;

Did post a query about 20 minutes earlier that this, but since I'm a forum newbie, my post didn't appear until a lot later.



Looking forward to the example!

Mikey

::Hybrid Two::Binary Zoo::RGT Veteran::
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Aug 2010 23:27
Yeah, I know. I approved it

Here's that simple example for getting the internal pointer to an object - it's not much, but it shows the correct technique for accessing a general plug-in (not just DBPro's own, for example, you can access mine too in this way).



You may not have the header files that I've included in this code, so I've attached them in a zip file - either drop them into a global directory in your include path (or add a new one), or drop them into each project folder as you create a new plug-in.

Other plug-ins pretty much work in the same way (except for the 'protected' extra plug-ins you can buy), but may or may not have ways to access their internals, e.g. for Basic3D, you have almost full access to the object data, but for Sprites, you have almost no access at all.

Attachments

Login to view attachments
Clonkex
Forum Vice President
9
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 19th Aug 2010 10:53
Thanks, I will have a look at the code later.

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
Clonkex
Forum Vice President
9
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 13th Oct 2010 05:39
Is Basic2D usable from another DLL? I need it to make my GUI system. Not that I actually know enough C++ to do that yet but I thought I may as well ask now anyway.

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
Clonkex
Forum Vice President
9
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 13th Oct 2010 05:42
What's this:

Quote: "a global directory in your include path"


Or how do you do this:

Quote: "add a new one"


And what is globstruct etc. for?

Thanks,
Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Oct 2010 15:37
Quote: "Is Basic2D usable from another DLL?"

Yes, in exactly the same way. You can use the DUMPBIN commandline program to extract the function names from the DLL, and the UNDNAME commandline utility to translate the mangled names given into usable C++ prototypes.

Quote: "What's this:

Quote: "a global directory in your include path""

Exactly what it says. If you have a directory for header files already available and set up within your IDE, then drop these header files into that directory, unless you'd rather not.

Quote: "Or how do you do this:

Quote: "add a new one""

Google it. It's fairly simple.

Quote: "And what is globstruct etc. for?"

globstruct.h is the structure for a shared area of memory for various DBPro internal settings and values.
DBOData.h contains the structures used by DBPro for object/limb management.
global.h contains some shared general settings (it's not really important).

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Matty H
11
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 16th Oct 2010 18:13
If I want to test this code in DarkGDK, so without exporting etc..
How can I do that?

What can I pass from GDK to this function?


I have tried: dbGetGlobPtr()
and: g_pGlob

But nothing is working, is it even possible, thanks for any help.

IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 16th Oct 2010 21:55
You don't do it like that - in the GDK world, there's nothing to call your special 'DBPro' functions for you.

Right now, the simplest way to get the globstruct pointer in GDK is to include the globstruct.h file (if not already included), then declare an extern variable with the correct definition:


Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Matty H
11
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 16th Oct 2010 22:42
Thanks IanM, I am using your code from this thread as a guide and there seems to be plenty of information out there for making a dll for DBPro.
The bit I dont understand is that once it is written how do I do a GDK version of my plugin?
Do I have to write all my functions twice? Accessing all the internal data in two seperate ways?

Thanks for any help, I still have alot of reading up to do on this, although the pieces are slowly coming together for me.

IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Oct 2010 00:20
You don't need to jump through any of the hoops needed for plug-ins.

All you need to do for the GDK is set up your library project to create a static library (rather than an exe or dll), and to also create a header file containing the prototypes of all functions you are providing (maybe also including a #pragma to automatically link your lib whenever the header is used).

If your code needs to call existing functionality in one of the GDK libs, just call the functions required - when your lib is used as a part of another project, then the linker will automatically resolve the references from your lib with the functions from the GDK libs.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Matty H
11
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 17th Oct 2010 02:16
Thanks IanM, I have made a lib for DarkGDK before, just using the GDK functions when needed. In fact I am re-writing that same plugin(see sig) but for DarkGDK and DBPro.

I suppose I am just figuring out the best structure for my project so I am not writing anything twice. For example, I may have a function that needs to set an objects rotation, easy for GDK dbRotateObject(), but that wont work in my DBPro plugin(I dont think), for dbPro I need to jump through the hoops and get function pointers etc..

I was hoping I could access all dark basic 3D functions in a way that will satisfy both plugins(GDK and dbPro)?

It may be that I have all the information I need and I just need to look through it all again and restructure my design to filter out the dark basic calls and do two versions for the filtered out parts, if you think I am off track I would appreciate it if you point me in the right direction, thanks.

Clonkex
Forum Vice President
9
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 17th Oct 2010 10:25
Ok thanks.

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Oct 2010 15:43
You're welcome.

@matty halewood,
Quote: "I was hoping I could access all dark basic 3D functions in a way that will satisfy both plugins(GDK and dbPro)?"

You can do that.

I think that probably the easiest way is to make your DBPro plug-in code look like GDK code. Taking the first code post of mine:

WARNING - this code has not been compiled since being changed, but even so, should give you an idea on how to deal with it.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Matty H
11
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 17th Oct 2010 17:35 Edited at: 3rd Nov 2010 21:30
Brilliant, I will work through it, thanks alot IanM.


EDIT: For future reference, I changed a couple of things to get it to compile, I will come back and edit again if I find I have done something wrong:
EDIT2: Took away string cast, you need to change compiler settings to multibyte for this to work.



Clonkex
Forum Vice President
9
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 18th Oct 2010 02:35
What is #define WIN32_LEAN_AND_MEAN for?

And with the global directory in your include path, is that sticking it in a folder (filter) in the Solution Explorer? I'm still experimenting with C++ and I don't really know many terms.

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Oct 2010 21:16
Quote: "What is #define WIN32_LEAN_AND_MEAN for?"

It just excludes some stuff in the windows.h include file, making compilation fast - it has no effect on the compiled code.

Quote: "And with the global directory in your include path"

Permanent setting - Tools->Options, Projects and Solutions->VC++ Directories, Show Directories for: Include Files. Add a new directory and fill in the full pathname

OR
Temporary setting, only for a single project - Create your project, select the project properties, Configuration Properties->C/C++->General. Enter your full pathname in the Additional Include Directories

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Clonkex
Forum Vice President
9
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 20th Oct 2010 09:02
Thanks, that's good. I had just figured out the stuff about the global directories. I had to add SDL includes to do a tutorial (google LazyFoo).

Sorry for more questions, but......oh, I can't remember my question, now. That is sooo annoying!

Oh well will ask as soon as I remember...

Oh, yes! Just remembered! How do you know what commands you can use to control 3D objects from the DLL? For instance, to get the number of limbs you used number of frames (or something), which didn't make any sense.

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Oct 2010 15:15
Basically, if there's a command, you can access it. As I detailed above, you can use DUMPBIN to see what's available.

As for knowing what to access when you have it, that's something you'll need to learn for yourself - luckily you don't have to learn it the difficult way that I did, because the DBPro library source code is available on googlecode now.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Clonkex
Forum Vice President
9
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 22nd Oct 2010 08:21
Hey guys,

Quote: "As I detailed above, you can use DUMPBIN to see what's available."


No you didn't.

Do you know how to get the MSDN Library (apparently it's the help files for MS VC++....or at least it includes them). I have been looking for hours on Microsoft's website, and, typically, couldn't find anything. Micrsoft just LOVES to hide things. And make too many different sections on their website.

Btw I have been experimenting with OpenGL and SDL. I can't do anything yet, mainly for lack of decent documentation. I have been trying to set up a basic Cube-like (www.cubeengine.com, very interesting) setup, but failed to understand the errors that come with trying to access a struct defined in a different file....it gets errors.

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Oct 2010 15:17
Yes I did - quoted from my post above:
Quote: "Quote: "Is Basic2D usable from another DLL?"
Yes, in exactly the same way. You can use the DUMPBIN commandline program to extract the function names from the DLL, and the UNDNAME commandline utility to translate the mangled names given into usable C++ prototypes."


Quote: "Do you know how to get the MSDN Library"

It's a part of the windows SDK download.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Greenster
14
Years of Service
User Offline
Joined: 3rd Feb 2005
Location: US ©
Posted: 23rd Oct 2010 14:06 Edited at: 23rd Oct 2010 14:15
One thing that confuses even experienced programmers is the claim that DB and DBPro compiles to machine code executables. The reality is the code you write is compiled to jump-tables into packed memory loaded C binaries. Thus why it takes bloated structures and allocation scanning like you see in Ians code just to do trivial stuff that would otherwise be easy if there was actually an IAT like you would have with real machine code binaries, and not packed PE.

It is actually easy to extract them using anything that handles PE dumping. DB compiler can be written in very little code, most of the code in DBP and DB compiler is MD5 DRM. No hack for VA scanning though...sorry.
IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Oct 2010 21:55
Quote: "The reality is the code you write is compiled to jump-tables into packed memory loaded C binaries."

Actually, it IS compiled to binary. Not very efficient binary admittedly as there's extra code included for checking for errors and reporting the DBPro line number when they occur.

DBPro also provides a lot of information as a part of the 'blob' of data it appends to the executable - DLL list and related functions that need to be linked at runtime, internal fixups of variables & functions (which I could use to calculate function addresses, but don't right now), static data (for data statements), function and UDT signatures etc.

Again, admittedly, it's something that Lee reinvented and that is already be provided by the Windows PE format, but basically, if you need it, it's there.

Note: I reverse-engineered the DBPro 'blob' years ago, way before I was allowed access to the source code, so I'm not relating anything that others couldn't find out themselves if they really wanted to.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Matty H
11
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 24th Oct 2010 01:48
Here is a list of the commands in the DBProbasic3DDebug.dll:




Here are the ones I have used so far:



Just thought I would share, don't know whether this info is easily available to people or not.

Greenster
14
Years of Service
User Offline
Joined: 3rd Feb 2005
Location: US ©
Posted: 24th Oct 2010 16:34 Edited at: 24th Oct 2010 16:37
I looked a long time ago, it was sequential jump tables into packed DLL binaries, and even conditionals were in a DLL. The actual compiler is where I spent a lot of time. It's more of a packer and MD5 license checker than anything.

I've also reversed other BASIC compilers. Only 2 I've ever came across actually built a code section for the basic code, and even did generic PE and code optimizations. Event a hello world has a ~10MB memory map because of the current design in DBP.

Using an inline hook you can also get adresses with loadlibrarya modules by the way. I don't do much with it anymore, I once wanted to do a proper LUA module this way mainly for stack and string access, but it wasn't worth the time.
Clonkex
Forum Vice President
9
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 25th Oct 2010 04:58 Edited at: 25th Oct 2010 05:05
@matty halewood:

Thanks, that will prove very useful....will copy it.

@Greenster:

Either you're just making all that stuff up or you are a very experienced C++ programmer. I mean, with all the MD5 DRM and IAT and PE I have no idea in the faintest what you are talking about! Btw, MD5 is also a model format.

EDIT: Sorry, IanM, I didn't see you had said it just there. I was looking further up...or down...or something My bad.

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
Greenster
14
Years of Service
User Offline
Joined: 3rd Feb 2005
Location: US ©
Posted: 25th Oct 2010 12:01 Edited at: 25th Oct 2010 12:06
@Clonkex: Nah..PE/COFF format gets mapped into memory the same way it is on disk, and it's just a binary format with headers to give addresses to the loader. The rest is knowing API calls and IA-32 assembler. Believe it or not it doesn't take long to learn, and only get complicated when you're dealing with obfuscations.

I'm too lazy to code anything, that's why I use BASIC, Python, and LUA :p I might have published a free LUA plugin once for DBP using C, but it was limited. I forget if I ever did. I did it mainly to fix the flaw in Unity where you can't disable loaded modules for use in virtual user customizable distribution(disable system wide access).

I think you can classify DB and DBP as stack machines. The functions are converted to DLL calls and parameter are pushed from resource section of EXE.
Clonkex
Forum Vice President
9
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 28th Oct 2010 11:04
Why do you know C++ if you can't be bothered writing anything with it? I can barely use it at all and I'm attempting to write a wrapper for Bullet Physics (so far so good!). It's certainly not easy but I'm getting there.

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
Greenster
14
Years of Service
User Offline
Joined: 3rd Feb 2005
Location: US ©
Posted: 28th Oct 2010 23:37 Edited at: 28th Oct 2010 23:53
I learned it years ago. I'm not up on ISO stuff, but know most things. Low level threading and a lot of algorithmic stuff is still gray for me. Learning ISO and how to extract call and data usage from headers is pretty much it with C and variants.

Assembly and microcode are actually easier, but have the same algorithmic learning curve as C, just takes more hand writing code. That's math stuff though..I'll pass on writing physics and mesh operation code :p

Unless I'm being payed I usually am careful about what kind of stuff I take on. It can still catch you off guard on a time bases.
Matty H
11
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 30th Oct 2010 16:03
Taken from IanM's code:



Does anyone know how I can include this file in multiple cpp files?
I have tried putting:

at the top of my files but I still get:

This seems to be a common problem with globals and I have read that extern fixes it but I must be doing something wrong.

Thanks.

IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 30th Oct 2010 22:24 Edited at: 30th Oct 2010 22:25
You can't declare extern and initialise in multiple places, which is the outcome of the way you are trying to do this:
Quote: "extern GlobStruct* Core = 0;"


Put your extern declarations into their own header file, not including initialisation, then put the declared and initialised variables without extern into one of your .cpp files - preferably the one where you set their values (in this case, where your ReceiveCoreDataPtr function is - that's not critical, just neat )

Your.cpp:


Your.h:


Then just include the Your.h file into all modules that need access to those two fields. Also, make sure that you only extern variables that need to be shared.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Matty H
11
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 30th Oct 2010 23:16 Edited at: 30th Oct 2010 23:18
Ah, thanks alot IanM(again!!!), makes perfect sense.


EDIT: Could we change the name of the dll section from "dll talk" to "Ask IanM"

D Ogre
15
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 31st Oct 2010 02:27
I hate plugging another thread since anyone looking for the specific information can always search for it, but I'm going to do it anyways.

I have a thread on making a plugin with PureBasic using other DBPro plugins as dependencies. Just in case someone wants that info and just missed it. The thread also provides quick reference files for all functions contained within the DBPro 7.4 DLLs. Not sure if 7.5 differs too much over 7.4. I know the lists wouldn't be that hard to generate yourself. Hey, why reinvent the wheel? These have be done for you. They could be useful for C/C++ programmers also.

PureBasic Plugin Link:
http://forum.thegamecreators.com/?m=forum_view&t=165333&b=18
Greenster
14
Years of Service
User Offline
Joined: 3rd Feb 2005
Location: US ©
Posted: 31st Oct 2010 14:24
@D Ogre: There are a significant amount in 7.5. Also I'd be careful with PB, they have a lot of 'anti-wrapper' clauses in their license that covers almost everything outside of entire usage for end-user binaries.

I also use PB, it's good for stuff like this because native API and memory loaded DLLs are so easy to use without extracting symbols etc..
Clonkex
Forum Vice President
9
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 1st Nov 2010 00:09 Edited at: 1st Nov 2010 00:21
Sorry for not replying soon, but my ISP went down few a couple of days and I couldn't use the internet.

To start with, I HAVE THE DIRECTX SDK!!! YAY! I finally went to Armidale on Friday and used the Hi-Speed internet kiosks. I also downloaded the Havok SDK (twice, I ran out of time the first time). So now I can use the GDK and access DBPro stuff from in the DLL.

I am writing a wrapper for Bullet mostly as a learning experience. It actually involves very little complex maths since Bullet does all that for me. I have even more stuff working now but I have a rather serious problem. It's serious because it's halted development entirely. I have been trying to understand Xarshi's Xeno source files but they are very confusing. They are not commented at all. Of course, I don't comment my code either, it makes the code all messy, but it also makes it hard for anyone else to read.

So here is my problem. I have been trying to use the code IanM and matty halewood provided but it doesn't work. Yes, it compiles, but in DBPro it generates a generic Microsoft error (image attached). Here is the exact code that's in main.cpp, I just copied it directly from matty's post. I have my resource and string table files only so I can actually test in DBPro but they aren't the problem. If I comment out this line:



it works in DBPro, except nothing happens. But here is the whole code anyway:



It's in Multi-Byte mode if that makes any difference.

EDIT: I agree matty

Thanks,
Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.

Attachments

Login to view attachments
D Ogre
15
Years of Service
User Offline
Joined: 19th Nov 2003
Location:
Posted: 1st Nov 2010 00:25
@Greenster: Haven't compared the differences between 7.5 and 7.4 concerning the functions within DBPro DLLs. Still poking around with 7.4. I haven't gotten around to 7.5 yet. That's why I stated that I wasn't sure how much they differed.

There is nothing wrong with making plugin DLLs in PB for DBPro. You just can't make and release a language wrapper of PB to be used in another language. However, if it's for personal use only you could.
Clonkex
Forum Vice President
9
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 1st Nov 2010 00:57 Edited at: 1st Nov 2010 01:15
Lol you posted 3 minutes after my edit. That means you must be on my side of the world, or you're just up really late.

EDIT: Don't forget to read my above post! And help me with it!

Clonkex

Making games is easy.....finishing them is a different matter.

Intel Core 2 Duo 2.8Ghz, Nvidia GeForce 9400 GT 512mb, 1gb ram.
Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 1st Nov 2010 13:46
You found the line that doesn't work:
Quote: "sObject* Obj = dbGetObject(ObjectId);"


If you get an error, you know that dbGetObject must be NULL. So find out why it's NULL (Is the ReceiveCoreDataPtr function not getting called? Is GetProcAddress returning NULL? Is LoadLibrary actually loading the .dll?)

Find all this out, and THEN if you haven't solved the problem, tell us what you found out, and we'll see if we can help!

[b]
Matty H
11
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 1st Nov 2010 14:12 Edited at: 1st Nov 2010 14:16
@Clonkex
Try:

Instead of:


I actually had a problem with that too but just used this method, unless you are relying on some 3rd party plugins then you don't really need to worry about it.

IanM
Retired Moderator
17
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 1st Nov 2010 20:40
Quote: "(LPCWSTR)Dependencies[0]"

... will not give you what you appear to think it does. You have cast an LPSTR ('const char*') to an LPWSTR ('const wchar_t*'), which converts the pointer, but leaves the data it's pointing at unchanged - it's still char data, but you've lied to the compiler and told it that it's wchar_t data instead.

The way to fix this is to compile your project in the correct mode in the first place.

Right-click on your project and select properties. Then select 'Configuration properties' + General, and set the 'Character set' to multi-byte rather than unicode.

Quote: "It's in Multi-Byte mode if that makes any difference."

Check again. If you are needing to apply that cast to get the code to compile without throwing out an error message, then it's unicode, almost guaranteed.

Utility plug-ins (26-JUL-2010)
I'm applying terms of use that require you to wear a red nose and honk a horn whenever you use the Internet
Clonkex
Forum Vice President
9
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 3rd Nov 2010 05:13 Edited at: 9th Dec 2011 03:13
Nope, I figured it out. All you guys were wrong. I had EXPORT defined to export the DLL with extern "C" so I wouldn't have to enclose all my functions with it. I just defined EXPORTNOC without extern "C" and used that and it works.

I didn't put the cast there btw. I just copied all of matty halewood's code. He just changed yours to make it compile.

Thanks anyway.

EDIT: By wrong I mean you did not find the correct solution to the problem. Yes, you discovered potential problems, but they were not affecting it.

Clonkex

Diggsey
13
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 3rd Nov 2010 14:05
Quote: "I had EXPORT defined to export the DLL with extern "C""


Well why did you post us a code snippet which had it defined WITHOUT extern "C"...

Quote: "All you guys were wrong."


I was right on two accounts:
1) ReceiveCoreDataPtr was not getting called as I suggested
2) You should've at least tried debugging it yourself

[b]
Matty H
11
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 3rd Nov 2010 21:25
Quote: "Nope, I figured it out. All you guys were wrong."

No, IanM was correct, I took away the cast and changed to multibyte and it worked

Login to post a reply

Server time is: 2019-10-19 07:54:28
Your offset time is: 2019-10-19 07:54:28