Page 1 of 1

Import dll from directory

Posted: Mon Apr 08, 2019 11:52 am
by microdevweb
Hello everyone,

I try to use a library putted into a directory, but it doesn't work if my lib has not into the same directory of executable

For example

Code: Select all

import "Lib/myDll.lib'

endImport
Thank for your answers

Re: Import dll from directory

Posted: Mon Apr 08, 2019 2:38 pm
by skywalk
Going out on a limb...You can enter the full path in the Import statement. :?
Your snippet does not even end with double quotes " !!

Re: Import dll from directory

Posted: Tue Apr 09, 2019 8:01 am
by microdevweb
@skywalk,

for example that work but SPD_64.dll must be put into same directory of executable, can i change that ?
Thanks

Code: Select all

Import "LIB\SPD_64.lib"
    newLb(language.s)
    newSql(dbName.s)
    newForm(*title,width,height = 0)
    newF_V_Box()
    newF_H_Box()
    newF_G_Box(numberColumn)
    newF_Text(*label)
    newF_String(*label = 0)
    newF_Empty()
    newF_Date(*label = 0,currentDate = 0)
    newF_Container()
    newF_Combo(*label)
    newCallback(*callBack,event_type = #PB_All)
    newWinCallBack(*callBack,win_event)
    newF_Calendar(currentDate = 0,*label = 0)
    newF_Button(*label)
    newTabClText(*title,columnDbName.s,width.f)
    newTabClNumber(*title,columnDbName.s,width.f)
    newTabClLinked(*title,columnDbName.s,linkedTable.s,linkedColumn.s,showedColumn.s,width.f)
    newTabCalculated(*title,width.f,*callback)
    newTab(dbName.s,tableName.s)
    mainLoop()
  EndImport

Re: Import dll from directory

Posted: Tue Apr 09, 2019 8:57 am
by Josh
Skywalk has already written the answer.

Re: Import dll from directory

Posted: Tue Apr 09, 2019 10:15 am
by GedB
microdevweb wrote:@skywalk,

for example that work but SPD_64.dll must be put into same directory of executable, can i change that ?
Thanks

Code: Select all

Import "LIB\SPD_64.lib"
The path here is referring to the location of the lib file at compile time.

Microdevweb is asking about the location of the dll at runtime.

This I don’t know. DLLs are designed for registration with windows, not bundling with the app.

The logic of locating DLLs within windows is explained here: https://docs.microsoft.com/en-us/window ... arch-order

DLLs are loaded into memory once then shared. It might be worth trying to load the library with OpenLibrary. That allows you to specify a path.

Failing that you’ll probably have to modify the manifest. Hopefully somebody can help you with that.

The discussion on this topic may be helpful: viewtopic.php?f=13&t=54277





Sent from my iPhone using Tapatalk

Re: Import dll from directory

Posted: Tue Apr 09, 2019 10:36 am
by Mijikai
If the lib is not static the dll needs to be in the same directory as the lib afaik.

Re: Import dll from directory

Posted: Tue Apr 09, 2019 11:55 am
by jack
I know that placing the 32-bit dll in the \Windows\SysWOW64 folder and placing the 64-bit dll in the \Windows\System32 folder works, but this practice is frowned upon.

Re: Import dll from directory

Posted: Tue Apr 09, 2019 1:05 pm
by microdevweb
Thanks for your answers.

Re: Import dll from directory

Posted: Tue Apr 16, 2019 10:16 pm
by GedB
microdevweb wrote:Thanks for your answers.
Did you manage to get a working solution?


Sent from my iPhone using Tapatalk

Re: Import dll from directory

Posted: Wed Jul 03, 2019 11:11 am
by microdevweb
No i didn't sorry

Re: Import dll from directory

Posted: Wed Jul 03, 2019 11:55 am
by Olliv
See inside the LIB file and search DLL filename field in the LIB file.
There could be some place to insert full path directory.

If no space, no availabilities, but if there are some spaces characters or some null characters, path tests can be done.