Jump to content
The simFlight Network Forums

Error 5 with Open FSUIPC


Recommended Posts

Hi Peter,

 

I am trying to develop a little software to read some FSUIPC datas.

 

It is written with WinDev developping environnement, and use a dll (written in C) to comunicate with FSUIPC.

 

Right now, if I make one first openFSUIPC, I get "0", so it seems open. In fact, reading doesn't works because I get error 9 when attempting to read.

 

If I try another openFSUIPC, I get error "5 - Failed to create a file mapping object". I don't understand this error message.

 

For a second openFSUIPC, I should get error "1 - Attempt to Open when already Open".

 

So I don't really understant why openning is not working correctly.

 

Can you help me to understand this error 5 ?

 

Regards,

RE.

Link to comment
Share on other sites

I am trying to develop a little software to read some FSUIPC datas.

 

It is written with WinDev developping environnement, and use a dll (written in C) to comunicate with FSUIPC.

 

Right now, if I make one first openFSUIPC, I get "0", so it seems open. In fact, reading doesn't works because I get error 9 when attempting to read.

 

If I try another openFSUIPC, I get error "5 - Failed to create a file mapping object". I don't understand this error message.

 

For a second openFSUIPC, I should get error "1 - Attempt to Open when already Open".

 

So I don't really understant why openning is not working correctly.

 

Can you help me to understand this error 5 ?

 

So, how are you programming this DLL? Are you using the C library source and writing your own version, or are you binding with the C library file? Is "openFSUIPC" the name of your own function to call FSUIPC_Open?

 

Have you looked at the examples?

 

The complete source of the interface is supplied in the SDK, so it should be easy enough for you to use your development system to debug it all to see what is going on.

 

What is error 9 defined as? Sorry, I don't have easy access to my source at present, and I'm not even sure you are using it. If the Open succeeds but a Read fails it is likely you have the data for the latter wrong. The FSUIPC_Read and FSUIPC_Write functions simply manipulate data in your own program, they don't do anything across any interface. For a program external to FS they update the set of requests in the shared memory area obtained by the Open call.

 

After a successful Open you need to Close it before trying to Open again -- if not you will probably get an error, as you found.

 

You say you don't understand file mapping? The FSUIPC interface is based on exchanging data through memory in what is known as a memory-mapped file. This 'file' object is created by a call into Windows. If that call returns an error, you get the error reported. As to WHY you are getting this error, if it isn't related to the fact that you didn't close the link first before trying to reopen it, I wouldn't be able to tell you. I'd need to debug your code -- but you should be able to do that. I assume you have a debugger in your development system?

 

Regards

Pete

Link to comment
Share on other sites

My understanding is that FSUIPC Error Number 5  "Failed to create a file mapping object"  results from a call to CreateFileMapping() function if the attempt to create a file mapping object fails, or the object exists before the function call.

 

FSUIPC Error Number 9 "Call cannot execute, link not Open"  is a consequence of a call to MapViewOfFile() failing to get a view of the object..

 

 

 

 

 

Link to comment
Share on other sites

Thanks for your answers.

 

Yes Peter, I have a debugger tool. The Dll written in C works well. After several investigation, I found that the problem is more Windev application related. I have no clues right now to investigate the problem, but I will certainly ask some help in WInDev forum.

In fact, it is very strange ... The dll debugger shows  that dll works fine (stand alone), but as soon as dll internal calls are made by windev, I have these strange error :???: . Pretty sure it is a memory problem (Windev auto allocate memory)...

 

As now I know it is not really an FSUIPC problem, or SDK using problem, we should close this topic :mrgreen:

Regards, and nice week-end.

 

Renaud.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.