PureBasic Forum
http://forums.purebasic.com/english/

Import dll from directory
http://forums.purebasic.com/english/viewtopic.php?f=13&t=72603
Page 1 of 1

Author:  microdevweb [ Mon Apr 08, 2019 11:52 am ]
Post subject:  Import dll from directory

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:
import "Lib/myDll.lib'

endImport


Thank for your answers

Author:  skywalk [ Mon Apr 08, 2019 2:38 pm ]
Post subject:  Re: Import dll from directory

Going out on a limb...You can enter the full path in the Import statement. :?
Your snippet does not even end with double quotes " !!

Author:  microdevweb [ Tue Apr 09, 2019 8:01 am ]
Post subject:  Re: Import dll from directory

@skywalk,

for example that work but SPD_64.dll must be put into same directory of executable, can i change that ?
Thanks
Code:
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

Author:  Josh [ Tue Apr 09, 2019 8:57 am ]
Post subject:  Re: Import dll from directory

Skywalk has already written the answer.

Author:  GedB [ Tue Apr 09, 2019 10:15 am ]
Post subject:  Re: Import dll from directory

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:
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

Author:  Mijikai [ Tue Apr 09, 2019 10:36 am ]
Post subject:  Re: Import dll from directory

If the lib is not static the dll needs to be in the same directory as the lib afaik.

Author:  jack [ Tue Apr 09, 2019 11:55 am ]
Post subject:  Re: Import dll from directory

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.

Author:  microdevweb [ Tue Apr 09, 2019 1:05 pm ]
Post subject:  Re: Import dll from directory

Thanks for your answers.

Author:  GedB [ Tue Apr 16, 2019 10:16 pm ]
Post subject:  Re: Import dll from directory

microdevweb wrote:
Thanks for your answers.


Did you manage to get a working solution?


Sent from my iPhone using Tapatalk

Author:  microdevweb [ Wed Jul 03, 2019 11:11 am ]
Post subject:  Re: Import dll from directory

No i didn't sorry

Author:  Olliv [ Wed Jul 03, 2019 11:55 am ]
Post subject:  Re: Import dll from directory

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.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/