x

dot net clr function for 64 bit SQL Server

Hi All,

When creating a CLR function for SQL Server do I need to compile two separate versions, one for 32 bit and one for 64 bit SQL server instances?

more ▼

asked Mar 09, 2010 at 08:15 AM in Default

Adrian Heald gravatar image

Adrian Heald
31 1 1 1

(comments are locked)
10|1200 characters needed characters left

2 answers: sort newest

What Matt said is true if you do not make a call to some assembly targeted to a specific platform or an unmanaged code for specific platform.

If you compile CLR assembly targetting it to AnyCpu and run this on x64 system, then it will be executed as x64 assebly. Although if you make a call to other unmanaged code or CLR assembly that is targeted to x86, then you will receive an exception of bad image format.

So if you need to call assemblies for different platforms, then you have to make two separate builds.

If you will have clear .NET code in the assembly and all will be targeted for AnyCpu, then you need only one build targeted for AnyCpu.

more ▼

answered Mar 09, 2010 at 11:34 AM

Pavel Pawlowski gravatar image

Pavel Pawlowski
22.3k 9 11 21

+1 - yep definitely a clearer answer than mine! :)
Mar 10, 2010 at 05:33 AM Matt Whitfield ♦♦
(comments are locked)
10|1200 characters needed characters left

No, CLR code compiles to CIL / MSIL and the common language runtime handles it's targetting to the relevant processor type.

more ▼

answered Mar 09, 2010 at 08:43 AM

Matt Whitfield gravatar image

Matt Whitfield ♦♦
29.5k 61 65 87

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x27
x27
x24

asked: Mar 09, 2010 at 08:15 AM

Seen: 2180 times

Last Updated: Mar 09, 2010 at 08:15 AM