Jump to content
The simFlight Network Forums

Prepar3d Load External DLL Issue


Recommended Posts

I have recently installed Perpar3d V1.4 and I am having a problem loading as external DLL. I am using FSUIPC Version 4.853. I also have these same lua scripts in FSX running the same version of FSUIPC and everything is working AOK in FSX.

My problem is when I execute the following statement I get an error in the log.

require (luacom)

Error Message --------------------------------------------------

281348 *** LUA Error: error loading module 'luacom' from file 'E:\Program Files (x86)\Lockheed Martin\Prepar3D\modules\lua\luacom.dll': The specified module could not be found.

---------------------------------------------------------------------

I have made sure that the luacom.dll is located in the lua subdirectory. To test this I removed the luacom.dll file and received the following log message

Error message --------------------------------------------------

1013664 *** LUA Error: ...)\Lockheed Martin\Prepar3D\Modules\thall_56T_led.lua:5: module 'luacom' not found:

no field package.preload['luacom']luacom

no file 'E:\Program Files (x86)\Lockheed Martin\Prepar3D\modules\luacom.lua'

no file 'E:\Program Files (x86)\Lockheed Martin\Prepar3D\modules\luacom\init.lua'

no file 'E:\Program Files (x86)\Lockheed Martin\Prepar3D\modules\lua\luacom.lua'

no file 'E:\Program Files (x86)\Lockheed Martin\Prepar3D\modules\lua\luacom\init.lua'

no file 'E:\Program Files (x86)\Lockheed Martin\Prepar3D\modules\lua\luacom.dll'

no file 'E:\Program Files (x86)\Lockheed Martin\Prepar3D\modules\lua\loadall.dll'

---------------------------------------------------------------------

I have tried copying the dll's to the c:\windows directory.

I created a subdirectory named DLL and place all the dll's in that directory.

I have placed all the dll's in the Prepar3d main directory.

Nothing so far has corrected the issue.

Thanks for any assistance you can offer.

Terry

======================

Troubleshooting Update

======================

In the FSX setup I am required to have a dll named lua5.1.dll in the FSX main directory for the luacom.dll to function.

In troubleshooting I removed the lua5.1.dll file from the FSX main directory and I received the exact same error

57190 *** LUA Error: error loading module 'luacom' from file 'E:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\modules\lua\luacom.dll': The specified module could not be found.

It would appear that FSUIPC when used in prepar3d is not looking in the proper location for the lua5.1.dll file that luacom.dll requires.

Is there a debug option in FSUIPC that can be turned on to show what directory FSUIPC is searching for dll's ?

Thanks again for any assisatance.

Terry

Link to comment
Share on other sites

I have recently installed Perpar3d V1.4 and I am having a problem loading as external DLL. I am using FSUIPC Version 4.853. I also have these same lua scripts in FSX running the same version of FSUIPC and everything is working AOK in FSX.

Hmm. Strange. I'm not sure what is going on. I can't imagine why the process being P3D instead of FS would make any difference at all to this, as that just doesn't come into it. You seem to have tried all the sorts of things I would have tried.

I'm not sure how I can help really as the code which does this stuff is part of the standard Lua 5.1 interpreter which is bundled into FSUIPC. I really haven't worked through all of its internal complexities. I'll try to test it myself, but I'm not sure when I can at present. If I can't fit it in before Wednesday next then I'm afraid it's not going to be till mid-January, as I'm away for a while.

Regards

Pete

Link to comment
Share on other sites

Thanks Pete for your response.

I have made a temporary work around by executing a batch file using os.execute. It works but is not as pretty since this method results in command windows flashing as the batch file is executed.

If you are not able to get to this until you return it won't stop me from my p3d evaluation.

Terry

Link to comment
Share on other sites

If you are not able to get to this until you return it won't stop me from my p3d evaluation.

I've had a preliminary look in preparation for testing. I note from the PDF documenting LuaCOM that each thread running the DLL needs COM initialisation and closure (CoInitialize() and CoUnitialize() APIs) before and after. My code isn't doing this at present. Is it something you've taken care of somehow? Possbly for some reason in FSX it wasn't needed but P3D does differently?

Also, I will need to test using the same LuaCOM.dll as you. Are you using the one I linked to at the end of my Lua Plug-Ins doc? I can't see a ready-made DLL there, only the sources which would need making. I found binaries on

http://www.tecgraf.p.../~rcerq/luacom/

but which one of these?

"Files can be downloaded from the links below, or from LuaForge.

And what is "LuaBinaries"?

Maybe you could link me to the one you are using?

Regards

Pete

Link to comment
Share on other sites

Pete,

I am not doing anything with the COM initialization that you mention so this must be something FSX is handling.

I have attached the luacom.dll and lua5.1.dll I used in FSX that I copied to my p3d installation. In FSX is was required to place the lua5.1.dll in the FSX main directory.

Terry

Link to comment
Share on other sites

Got them, thanks. I'll try to make time to look at it in the next few days. Else it won't be till mid Jan when i get back.

Okay, I had a quick look. The problem isn't with LuaCom, but with Lua5.1.dll. It is compiled using an earlier version of the MSVC run-time library than Prepar3D 1.4. -- MSVCR80.DLL to be precise. This is the same as that used by FSX so there's no problems there.

If i find my MSVCR80.DLL and put it next to Lua5.1.dll in the P3D folder I still get an error, but a different one -- "not a valid application". I think this is misleading. I think the error derives from a clash between the MSVCR100.DLL library already in use by P3D and the older one.

I had the same problem with FSUIPC4 when Lockheed Martin moved on to the newer library. This was a significant change between 1.3 and 1.4. I got around it by recompiling FSUIPC4 with static library options instead of dynamic -- i.e. compiling the library functions needed into FSUIPC4 rather than calling them in the DLL. This is a link-time option for any MSVC project.

So, I'm afraid you've no option but to download the source of Lua5.1.dll and recompiling/relinking it with such an option. I suspect this would be useful to others too, so if you do it please consider letting me host it or at least link to it in my SubForums. If you are not in a position to do it yourself, and no one else has done it for you by the time I get back mid-January, let me know and I'll try to do it for you.

Regards

Pete

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.