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 https://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.

  • Makefile use DESTDIR to alter destination when defined andset. Why does not: make DESTDIR=/path install satisfy the C# DLLImport relative path requirement? – Frank Feb 3 '16 at 10:59

On Ubuntu Linux 15.10 , The way I fixed this problem is to prepend "lib" to "3rdparty.so" and change [DllImport("3rdparty.so")] in my C# code to [DllImport("3rdparty")] .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.