3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: dll access time  (Read 283 times)

« on: December 03, 2013, 04:07:49 PM »
Hi everyone!
I'm trying to make an simulation using 3D Rad and, in order to do that, I need to get some data from the COMx Port (I have a device connected to that port from which I want to collect the messages sent). From what I searched, I couldn't find a direct method for 3D Rad to connect to the COM port. So, I wrote a DLL in c++ that opens the port, waits for a message, splits the message into an array of floats, closes the COM port and transmits the float array back to 3D Rad. All good, in theory (at least this is how I imagined it :D ), but it doesn't work. The DLL is recognised, the method is called, but no result is returned. I tested the method in a console app and it works. What could be the problem? Does 3D Rad has a timeout when calling a DLL method? If this is the case, what is it? Or, can anyone give me another solution to read messages from a COM port..?
Thanks in advance for your answers :)
« Reply #1 on: December 04, 2013, 08:11:45 AM »
i think 3DRAD communicates data back and forth to DLLs via an array of floats (sorry, it's been a while)... 

look at the script reference manual (iDLLArraySet(int,float) and iDLLArrayGet(int) ) for more info...

also, i think there's a demo DLL project which may give you more info...


--Mike




« Reply #2 on: December 05, 2013, 03:55:14 PM »
Hi Mike, thanks for the reply.
I know how to communicate with the DLL method using the array of floats. The problem for which I created this topic is another, like I mentioned before: in 3D rad I have a script that calls a method from a DLL. Everything works till this point. Yet, if inside the DLL method I do only a small calculation and then pass the array of floats, it works, but, if, and this is my case, I do some complex calls, like opening a COM port, reading data from that port, closing the port, parsing the message and putting it in the array of floats, the call from 3D rad doesn't return any value.
This is why I am asking if 3D rad is built with some kind of timeouts when calling a DLL method or it waits until the method finishes and the returns the values? From what I have experimented, it seems that the first statement is true...that 3D rad has some timeouts. What I need to know is that, if these timeout exist, is there any way to find out their value? Or if they can be modified?
« Reply #3 on: December 06, 2013, 03:25:23 PM »
I know that my question is a little awkward...but doesn't anyone know how this DLL method communication mechanism was implemented in 3D Rad? :-s
« Reply #4 on: December 07, 2013, 09:06:36 AM »
Quote
I am asking if 3D rad is built with some kind of timeouts when calling a DLL method or it waits until the method finishes and the returns the values?

sorry i didn't understand the question...

i cannot say for certain whether 3DRAD's dll interface logic has a built in timeout...  i don't have access to the code nor have i looked into disassembling the core code...

i would though, tend to think that there would be no logic reason for a timeout to be part of the  dll data transfer logic... i mean, why would such why it would be necessary to implement  a timeout...

i could be wrong though...

also... from what i remember (it's been a verrrrrry looooooooooooong time), data transfer through COM ports does have asynchronous timing considerations that must be dealt with...  but i would imagine that would be on the dll side logic...

anyway, as to your problem...

first... does your dll logic work as a standalone... if so, then it would tend to lend credence (though not absolutely), to your assumption... at least it would validate the dll... 

--Mike

« Reply #5 on: December 08, 2013, 11:46:25 AM »
Hi Mike :)
Thanks again for your answer. I tested the DLL method as a standalone c++ console application and it works. This is why I think that it may exist some kind of timeouts inside 3D Rad, for not blocking the script until a response from a DLL method that takes a lot time to complete. Unfortunately I need a way to communicate through the COM port that's why I'm insisting on this aspect :D
Now I'm trying to make a service that will listen to the COM port. Then, my 3D Rad script will fetch the results by using, still, a DLL method that will connect through a named pipe to the service and get the results from that pipe. I know, it's a little bit complex...but I hope that it will be faster and will work with 3D Rad :D
« Reply #6 on: December 09, 2013, 08:34:14 AM »
Quote
I think that it may exist some kind of timeouts inside 3D Rad, for not blocking the script until a response from a DLL method that takes a lot time to complete.

another suggestion...
if 3DRAD isn't waiting for the data to be ready, why not have the dll return something like -9999 when the data is not ready...  and on the 3DRAD side, have the results ignored whenever it is -9999... 

you are going to have to set up a simple handshake logic between the dll and 3DRAD so that the dll is notified when 3DRAD is sending up a request for data, so that once there is valid data, it will be sent on the next request and then replaced with the not ready flag value...

if 3DRAD is "not blocking the script until a response from a DLL", then something like this should work...


--Mike
« Last Edit: December 09, 2013, 10:06:25 AM by Mike Hense »
Pages: [1]