tags:

views:

269

answers:

1

I have a C# project consisting of stored procedures that reference a win32 dll from another project in the solution. Currently, dllimport is using absolute paths to reference it. If I use a relative path instead, where is that path relative to once the clr stored procs assembly is loaded in sql server?

A: 

Good question, since the DLL is not physically available. My guess is that it will look where the host lives (e.g. SQL server binaries). But I'd try to find out with Process Monitor or similar on a machine with a test instance; SQL server will try to find the file and this should be visible in the process monitor log.

That said, you can also use the system LoadLibrary and GetProcAddress calls and bind delegates to the address you get back using the Marshal class if necessary, since this allows you to perform proper late binding to a computed DLL path.

Lucero