Link to home
Start Free TrialLog in
Avatar of camster123
camster123

asked on

How to change the Output Directory in a LINUX makefile so that a shared object can be relatively specified in C# DLLImport?

I would like to find out how to change the Output Directory in a LINUX makefile so that a shared  object can be relatively specified in C# DLLImport?

I read the following hint in
          http://stackoverflow.com/questions/8316992/dll-import-path-how-to-get-dll-path-which-located-in-other-folder

Change the Output Directory setting in the C++ project to $(SolutionDir)bin\$(ConfigurationName) so that the native DLL ends up in the same folder as your managed program. Just use [DllImport("3rdparty.dll")] in your C# code. – Hans Passant Nov 29 '11 at 20:38

I would like to know to do this in a makefile used in Ubuntu Linux 15.10.

Any help is greatly appreciated.
Avatar of arnold
arnold
Flag of United States of America image

Usually, Makefile use DESTDIR to alter destination when defined andset.

make DESTDIR=/path install
Avatar of camster123
camster123

ASKER

@arnold,
   Thank you for your solution.
What if I do not have an install option in my LINUX makefile? Will your solution still work?
@arnold, make DESTDIR=/path install did not fix my C# DLLImport relative path requirement. Please suggest an alternate way.
Your question, is it for Linux or windows?

After rereading and your last comment, I am unclear on what you are after.

To add libraries, I uses -L/path/where/libraries  you can multiple references added .........
@arnold,
  My question is for Ubuntu Linux 15.10.
Thank you.
To add paths to locate libraries you would use the -L option in the referenece to c/C++

-I adds include locations
-L adds library locations

-ldb4 adds/loads a specific in this case db4

A Makefile is a set of commands the items will be added to the commands
Often a Makefile has predefined variables which are included/referenced within with the gcc/g++ etc.

lets say you compiled a library in /home/users/camster
using the -L/home/users/camster/build -I/home/users/camster/build
presumes you have the source code with
include "somefile.h"


the -I parameter will help the compiler locate the somefile.h in the /home/users/camster/build while the -L will help the compiler locate the objects/etc.
ASKER CERTIFIED SOLUTION
Avatar of arnold
arnold
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Arnold's solution solved the problem.