Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Feb 27, 2020 12:44 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: Declare custom dynamic libarary (dll)
PostPosted: Mon Jan 30, 2012 6:46 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
Hi all,

I'm curious if anyone has found a short way to the location of a dll in my application folder.

Let's say i have an app which can be installed anywhere on the system as the user requires.
Now for this example it's installed into "C:\MyApp\" with the dll here: "C:\MyApp\mylib.dll"

Does anyone know a constant placeholder or system flag to navigate to that folder (as each user can install where they want)?
I have read on the forums about "@executable_path" but it doesn't seem to work on windows.

Thanks in advance.

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: Declare custom dynamic libarary (dll)
PostPosted: Mon Jan 30, 2012 7:14 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
swort wrote:
Hi all,

I'm curious if anyone has found a short way to the location of a dll in my application folder.

Let's say i have an app which can be installed anywhere on the system as the user requires.
Now for this example it's installed into "C:\MyApp\" with the dll here: "C:\MyApp\mylib.dll"

Does anyone know a constant placeholder or system flag to navigate to that folder (as each user can install where they want)?
I have read on the forums about "@executable_path" but it doesn't seem to work on windows.

Thanks in advance.


@executable_path is an OS X thing and will not work for windows

For windows just use "mylib.dll" and it should be located in the libs directory next to your application

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Declare custom dynamic libarary (dll)
PostPosted: Mon Jan 30, 2012 7:20 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
npalardy wrote:
swort wrote:
Hi all,

I'm curious if anyone has found a short way to the location of a dll in my application folder.

Let's say i have an app which can be installed anywhere on the system as the user requires.
Now for this example it's installed into "C:\MyApp\" with the dll here: "C:\MyApp\mylib.dll"

Does anyone know a constant placeholder or system flag to navigate to that folder (as each user can install where they want)?
I have read on the forums about "@executable_path" but it doesn't seem to work on windows.

Thanks in advance.


@executable_path is an OS X thing and will not work for windows

For windows just use "mylib.dll" and it should be located in the libs directory next to your application


Hi norman,

Thanks i will try it.

(still hoping for RB to have an option to compile dynamic libraries itself, should leave some confused stuff away from switching IDE's and languages).

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: Declare custom dynamic libarary (dll)
PostPosted: Mon Jan 30, 2012 7:29 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
Quote:
For windows just use "mylib.dll" and it should be located in the libs directory next to your application


it doesn't seem to place mylib.dll into the "MyApp Libs" folder... there is not even a "MyApp Libs" folder there...
How can i make sure that the dll will be included into that "MyApp Libs" folder?

thanks.

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: Declare custom dynamic libarary (dll)
PostPosted: Mon Jan 30, 2012 8:19 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
there's no reason the IDE should be expected to know to copy the dll there

you can
1) manually copy it there
2) use a post build script

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Declare custom dynamic libarary (dll)
PostPosted: Mon Jan 30, 2012 8:38 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
npalardy wrote:
there's no reason the IDE should be expected to know to copy the dll there

you can
1) manually copy it there
2) use a post build script


Ok, i use a CopyFileStep and now it's in any build (and debug) placed inside the folder "MyApp Libs".
Still it won't work.

The dll is not loaded, soft declare wont work and hard won't do it also.

I'm on windows 7 using a "normal windows dll" (NOT a .net one).
It's a dynamic link library and there should be no reason RS can't load it.

The method name is not in use already as it's called test() which is showing a msgbox like thing.

Tested the dll to be working in PureBasic, and FreeBasic. Not working in RealBasic.

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: Declare custom dynamic libarary (dll)
PostPosted: Mon Jan 30, 2012 9:09 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
So i got it working from the "C:\mydll.dll" (in the External Method).

Now i want to load it from inside the "MyApp Libs" folder, how can i do that?
As that's the problem that would not work when i try to do "mydll.dll" in the "Lib" part of the Declare.


On the other languages, i wont even need to give a path as it will be loaded always (doesn't seem to need a path).

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: Declare custom dynamic libarary (dll)
PostPosted: Mon Jan 30, 2012 9:12 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Does Windows really include "MyApp Libs" in the search path? Try putting it next to the .exe instead.


Top
 Profile  
Reply with quote  
 Post subject: Re: Declare custom dynamic libarary (dll)
PostPosted: Mon Jan 30, 2012 9:20 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
timhare wrote:
Does Windows really include "MyApp Libs" in the search path? Try putting it next to the .exe instead.


no i did not type it into the Library path.
As always timhare, your right that works...;)

this makes me happy but still now i have RS libraries & my own libraries.

Both are in different locations, doesn't look really professional aint it...

Anyway it works thanks both Norman and Tim.

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: Declare custom dynamic libarary (dll)
PostPosted: Mon Jan 30, 2012 10:06 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
You could put the RB libraries in the same place. Don't know how you feel about that, but it's not completely unprofessional to have them all next to the .exe.


Top
 Profile  
Reply with quote  
 Post subject: Re: Declare custom dynamic libarary (dll)
PostPosted: Tue Jan 31, 2012 2:57 am 
Offline

Joined: Wed Dec 14, 2011 4:20 am
Posts: 84
swort wrote:
So i got it working from the "C:\mydll.dll" (in the External Method).

Now i want to load it from inside the "MyApp Libs" folder, how can i do that?
As that's the problem that would not work when i try to do "mydll.dll" in the "Lib" part of the Declare.


On the other languages, i wont even need to give a path as it will be loaded always (doesn't seem to need a path).



Try this:
set PATH=c:\MyDLLFolder;%PATH%

or
set PATH="C:\My DLL Folder";%PATH%


or add the path into windows system Environment Variables.

On windows 7: Right mouse click on Computer Icon > Properties > Advanced System Settings > Advanced > Environment Variables

You can either add the environment to the user (User Variables) only or Global (System Variables)


Top
 Profile  
Reply with quote  
 Post subject: Re: Declare custom dynamic libarary (dll)
PostPosted: Tue Jan 31, 2012 12:25 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
swort wrote:
So i got it working from the "C:\mydll.dll" (in the External Method).

Now i want to load it from inside the "MyApp Libs" folder, how can i do that?
As that's the problem that would not work when i try to do "mydll.dll" in the "Lib" part of the Declare.


On the other languages, i wont even need to give a path as it will be loaded always (doesn't seem to need a path).


Ah yeah sorry about the bad advice
Put the DLL next to your app otherwise you have to alter the search path to include the Libs dir
Windows will by default find them if they are next to the exe
It's the first place it looks

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Declare custom dynamic libarary (dll)
PostPosted: Tue Jan 31, 2012 12:28 pm 
Offline
Real Software Engineer

Joined: Sat Dec 24, 2005 8:18 pm
Posts: 7858
Location: Canada, Alberta, Near Red Deer
J.Hansen wrote:
Try this:
set PATH=c:\MyDLLFolder;%PATH%

or
set PATH="C:\My DLL Folder";%PATH%


or add the path into windows system Environment Variables.

On windows 7: Right mouse click on Computer Icon > Properties > Advanced System Settings > Advanced > Environment Variables

You can either add the environment to the user (User Variables) only or Global (System Variables)


You might even be able to do that right in the open event of your app & alter the path JUST for your app
Not sure if that will work or not

_________________
Norman Palardy (Real Software)


Top
 Profile  
Reply with quote  
 Post subject: Re: Declare custom dynamic libarary (dll)
PostPosted: Tue Jan 31, 2012 5:25 pm 
Offline

Joined: Mon May 31, 2010 5:35 am
Posts: 2412
Location: Netherlands
timhare wrote:
You could put the RB libraries in the same place. Don't know how you feel about that, but it's not completely unprofessional to have them all next to the .exe.


Should be much better, but still there is no "option" to build that way.
It's all hand work, and not perfect. I have not 1 project, but different projects.
Should be much more easy as in other languages...;)

Quote:
Try This

set PATH=c:\MyDLLFolder;%PATH%

or
set PATH="C:\My DLL Folder";%PATH%


How can i do that?
Just put that exact line in the open event wont be it right?

do i need to call System.EnvironmentVariable("set PATH="C:\My DLL Folder";%PATH%") ?!?

Many thanks all.. :D

_________________
SWORT™
- Windows Vista, Windows XP, Windows 7, Linux Mint 11 and Mac OSX Lion
- REAL Studio Enterprise(latest) and WEB Edition(latest)
- Plugins (MBS Complete, ToringoLib, Einhugur, VanHoek + Some open source plugins)
For Dutch User Groups ask me to enter!


Top
 Profile  
Reply with quote  
 Post subject: Re: Declare custom dynamic libarary (dll)
PostPosted: Tue Jan 31, 2012 6:14 pm 
Offline

Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12388
Location: Portland, OR USA
Wouldn't your installer put the dll in the right place for you?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group