Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
Game exe loads external dll to calculate a function

rand3d
Registered User
Quote
2019-09-01 02:05:48

Hi,
I'm trying to make my game.exe load a premade dll ( a registered active x ,visual studio compiled) and use its public functions.

ActiveXObject is not working and raise err as undefined function in the immediate debug window.

Help!



// Not Working Code
var desired_DLL=new ActiveXObject ("CO.Vile")




erik
Registered User
Quote
2019-09-02 08:05:12

ActiveXObject is an Internet Explorer API, it won't work in CopperCube.


rand3d
Registered User
Quote
2019-09-02 08:11:27

wrote:
ActiveXObject is an Internet Explorer API, it won't work in CopperCube.


Thank you for your kind replay,

Is there any way to call a dll from the engine?


xanimalkingx
Registered User
Quote
2019-09-05 03:03:11

From the way DLLs work, no it's not possible. The only way I could think of is by editing the source code to add a function that registers a DLL for use with the engine but that'd be kinda dangerous unless you took over how the DLL unloaded by yourself... plus you cant redistribute your custom build, since the studio license prohibits that...


rand3d
Registered User
Quote
2019-09-05 06:45:31

wrote:
From the way DLLs work, no it's not possible. The only way I could think of is by editing the source code to add a function that registers a DLL for use with the engine but that'd be kinda dangerous unless you took over how the DLL unloaded by yourself... plus you cant redistribute your custom build, since the studio license prohibits that...



Inspired by your suggestion, I'm thinking of editing the source code of the exported exe (which is written in c++, and supplied within the pro edition).
Is that possible?


xanimalkingx
Registered User
Quote
2019-09-05 10:19:57

I do not know C++ (which I assume CopperCube is coded in).
However, I do know that programs can "register" a DLL and then use its functions, and then unregister it whenever they are told to. I also know libraries have to have exported functions as a "managed DLL" if you want to use one externally without registering it as a COM object.
If you're trying to use a third party dll, make sure it has documentation (especially how to implement it into your project, like CopperCube) and that it makes a managed C++ DLL (calling .NET DLLs from C++ is possible but you must enable the Cross-Language Runtime (CLR) command-line option via Solution Options if you want to do this. This will let you import .NET classes in C++ code and let you use .NET dlls... however, I don't know how this will affect CopperCube's compile-time---like it may cause compile-time errors) with exported functions.
As far as the code goes, I can't help you. My expertise now is within CopperCube's JavaScript engine... which is severely limited...


rand3d
Registered User
Quote
2019-09-07 19:59:05

wrote:
I do not know C++ (which I assume CopperCube is coded in).
However, I do know that programs can "register" a DLL and then use its functions, and then unregister it whenever they are told to. I also know libraries have to have exported functions as a "managed DLL" if you want to use one externally without registering it as a COM object.
If you're trying to use a third party dll, make sure it has documentation (especially how to implement it into your project, like CopperCube) and that it makes a managed C++ DLL (calling .NET DLLs from C++ is possible but you must enable the Cross-Language Runtime (CLR) command-line option via Solution Options if you want to do this. This will let you import .NET classes in C++ code and let you use .NET dlls... however, I don't know how this will affect CopperCube's compile-time---like it may cause compile-time errors) with exported functions.
As far as the code goes, I can't help you. My expertise now is within CopperCube's JavaScript engine... which is severely limited...


great details, bro .. thank you


morice.cube
Registered User
Quote
2019-12-01 20:15:27

I hope you are using Coppercube for Windows Platform.
You should make an external app with communication to DLL File. After, this external app will unload a file with results as text file.

Your project of Coppercube will make a text file to external app and external app will return the result of Dll file as text file to Coppercube. And Coppercube will read the result of text file.

To create an external app you can use Visual Studio C.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "I?ternational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact