Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the root determination of the embedded Windows engine and load DLLs with altered search path (to search dependent DLLs on the same path of the loaded DLL) [CORE1814] #2244

Closed
firebird-automations opened this issue Apr 1, 2008 · 12 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @asfernandes

Is duplicated by CORE2345
Relate to CORE2628

This is a Windows specific proposal, with three items. The first is
independent, the second depends one the first and the third depends one
the first and the second.

1) If I use an UDF DLL that depends one others DLLs, I current can't put
all DLLs in <root>\udf. I need to put the dependencies in <root>\bin or
in some other place in %PATH%.

I propose we change ModuleLoader to load with LoadLibraryEx(...,
LOAD_WITH_ALTERED_SEARCH_PATH), so the dependencies are searched in the
same directory as the library being loaded.

2) Above change makes it possible to the application developer load
fbembed.dll with altered search path too. But our rules to determine
<root> is based on the application EXE directory.

I propose we change the root determination of the embedded engine to be
path of fbembed.dll. This is a change compatible with the current
documented way to use embedded, where fbembed.dll and the application
EXE should be in the same directory.

Commits: 2723814 c5cb7cb

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Version: 2.5 Initial [ 10260 ]

Fix Version: 2.5 Alpha 1 [ 10224 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

Version: 2.1 RC1 [ 10201 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Currently fbserver is unable to load own ib_udf.dll as it depends on ib_util.dll which placed in \bin folder while ib_udf.dll is in \udf ;)
I offer or put ib_util.dll in \udf or, better as for me, add \bin folder into altered search paths too.

@firebird-automations
Copy link
Collaborator Author

Commented by: @dyemanov

Putting it into /udf is not a good option, as people may have 3rd party UDF libs in other locations and they may also depend on ib_util. I don't think we should tell them to copy ib_util everywhere.

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Loading ib_util.dll in the engine, it will be already be loaded and no problems happen latter.

I'm going to do this, but if it can't be loaded there will be no error or warning...

Do you see any problem?

@firebird-automations
Copy link
Collaborator Author

Modified by: @asfernandes

Link: This issue is duplicated by CORE2345 [ CORE2345 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

I've a complains from users that FreeAdhocUDF is not worked when Firebird works as a service.

FreeAdhocUDF is dependent on fbclient.dll and on ib_util.dll. The second one is always loaded by the Firebird itself but fbclient.dll is not loaded.
And usage of LOAD_WITH_ALTERED_SEARCH_PATH prevents Windows from looking into application folder (firebird\bin) when dll (fbclient) is loaded.

Adding SetCurrentDirectory into WinMain fixed the issue.

Comments ?

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

Link: This issue relate to CORE2628 [ CORE2628 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @asfernandes

Vlad, what about this? http://msdn.microsoft.com/en-us/library/ms682600(VS.85).aspx

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

QA Status: No test

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: No test => Cannot be tested

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment