Using a external LIB
by Diego Perez · in Torque 3D Beginner · 02/10/2010 (7:08 am) · 6 replies
Hello,
I would like to use an external lib (C++ lib with some tools I have created). Is there any way to use this library using Torque Script? Can I use torque script to load a lib that is not integrated in Torque source engine?
Many thanks,
Diego.
I would like to use an external lib (C++ lib with some tools I have created). Is there any way to use this library using Torque Script? Can I use torque script to load a lib that is not integrated in Torque source engine?
Many thanks,
Diego.
About the author
#2
02/10/2010 (10:42 am)
You'll have to load the library on the C++ side and then create ConsoleFunctions that call your lib's function for use in the scripts.
#3
@Ronny: About the library loader... do you mean a library loader programmed in TorqueScript? Is there any domumentation about how to do such a thing out there?
@Both: About the other option, for doing that I would have to modify the project/source that Torque creates for me, wouldn't I? If so, this can't be an option for me, I have to keep the Torque source intact (as if I were a user with no access to the code) :S
I only can modify Torque scripts for doing this things (and my own lib, obviously).
Thanks again.
Diego.
02/10/2010 (11:20 am)
Thanks guys for your replies.@Ronny: About the library loader... do you mean a library loader programmed in TorqueScript? Is there any domumentation about how to do such a thing out there?
@Both: About the other option, for doing that I would have to modify the project/source that Torque creates for me, wouldn't I? If so, this can't be an option for me, I have to keep the Torque source intact (as if I were a user with no access to the code) :S
I only can modify Torque scripts for doing this things (and my own lib, obviously).
Thanks again.
Diego.
#4
Why would you have to keep the source intact? It's there for you to have fun with.
02/10/2010 (6:24 pm)
The library loader would be necessity be C++ with some TorqueScript glue functions. Dunno how I'd do it, since when you have the source, just plug it in normally :)Why would you have to keep the source intact? It's there for you to have fun with.
#5
If there is no chance to do it, maybe that requirement changes... but first I have to see if there is a way ;)
Thanks!
02/10/2010 (7:04 pm)
The fact that the source must be kept without modifications is a requirement of the project. The idea is that whoever needs my library can use it without the need to modify the source code (not willing to do it, or just that he has no access to it).If there is no chance to do it, maybe that requirement changes... but first I have to see if there is a way ;)
Thanks!
#6
02/10/2010 (7:37 pm)
You need to make some C++ changes to get the loader in. Then you probably need some custom code to extract function calls, present them as TorqueScript functions and also know how many arguments they take (and what types). You'll have to look into how people normally make plugins on your platform, and inspect the console method macros closely.
Torque 3D Owner Ronny Bangsund
Torque Cheerleaders