x
login about faq Site discussion (meta-askssc)

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 '10 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 '10 at 11:34 AM

Pavel Pawlowski gravatar image

Pavel Pawlowski
20.3k 5 10 20

+1 - yep definitely a clearer answer than mine! :)

Mar 10 '10 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 '10 at 08:43 AM

Matt Whitfield gravatar image

Matt Whitfield ♦♦
29.2k 56 63 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



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x27
x23
x18

asked: Mar 09 '10 at 08:15 AM

Seen: 1483 times

Last Updated: Mar 09 '10 at 08:15 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.