dbTalk Databases Forums  

External procedures in x64

sybase.public.sqlanywhere.general sybase.public.sqlanywhere.general


Discuss External procedures in x64 in the sybase.public.sqlanywhere.general forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dave Foulkes
 
Posts: n/a

Default External procedures in x64 - 01-08-2010 , 12:58 PM






I've been experimenting with the x64 version of ASA (10.0.1.3960) and I have
been unable to execute external procedures because the server "Could not
load dynamic library XXX.dll", even though the dll is on the path. This all
works fine on the x86 version under 32bit Windows. Is there something else I
should be doing?

TIA for any illumination.

Dave.

Reply With Quote
  #2  
Old   
Kory Hodgson (Sybase iAnywhere)
 
Posts: n/a

Default Re: External procedures in x64 - 01-08-2010 , 01:14 PM






Dave,

What type of external procedures have you been trying to execute?
What dll is the server failing to load?

From the product support matrix located here:
http://www.sybase.com/detail?id=1051965#footnotes_2 there is a footnote
saying: The older interface to external stored procedures is available
only in 32-bit software.


Dave Foulkes wrote:
Quote:
I've been experimenting with the x64 version of ASA (10.0.1.3960) and I
have been unable to execute external procedures because the server
"Could not load dynamic library XXX.dll", even though the dll is on the
path. This all works fine on the x86 version under 32bit Windows. Is
there something else I should be doing?

TIA for any illumination.

Dave.

Reply With Quote
  #3  
Old   
Karim Khamis [Sybase iAnywhere]
 
Posts: n/a

Default Re: External procedures in x64 - 01-08-2010 , 01:18 PM



Dave Foulkes wrote:
Quote:
I've been experimenting with the x64 version of ASA (10.0.1.3960) and I
have been unable to execute external procedures because the server
"Could not load dynamic library XXX.dll", even though the dll is on the
path. This all works fine on the x86 version under 32bit Windows. Is
there something else I should be doing?

TIA for any illumination.

Dave.

The 64bit server will not be able to load a 32bit dll and vice versa.
You need to rebuild the dll as 64bit to use it with the 64bit server.

Karim

Reply With Quote
  #4  
Old   
Dave Foulkes
 
Posts: n/a

Default Re: External procedures in x64 - 01-09-2010 , 05:47 AM



Kory,

Thanks for your response.

It's a home-grown dll using the new API, but it's (currently) 32-bit and
from Karim's reply it looks like I need a 64-bit version. I was rather
hoping that the server could "thunk" (or whatever the term is) the original
32-bit dll, but it looks like that's not possible.

Dave.

"Kory Hodgson (Sybase iAnywhere)" <khodgson (AT) A_SPAM_FREE_sybase (DOT) com> wrote in
message news:4b47842d$1 (AT) forums-1-dub (DOT) ..
Quote:
Dave,

What type of external procedures have you been trying to execute?
What dll is the server failing to load?

From the product support matrix located here:
http://www.sybase.com/detail?id=1051965#footnotes_2 there is a footnote
saying: The older interface to external stored procedures is available
only in 32-bit software.


Dave Foulkes wrote:
I've been experimenting with the x64 version of ASA (10.0.1.3960) and I
have been unable to execute external procedures because the server "Could
not load dynamic library XXX.dll", even though the dll is on the path.
This all works fine on the x86 version under 32bit Windows. Is there
something else I should be doing?

TIA for any illumination.

Dave.

Reply With Quote
  #5  
Old   
Dave Foulkes
 
Posts: n/a

Default Re: External procedures in x64 - 01-09-2010 , 05:55 AM



Karim,

Thanks for your reply. I presume then that there's no simple way to wrap up
a 32bit dll for use with the 64bit ASA server - it's 64bit or nothing.

Dave.

----- Original Message -----
From: "Karim Khamis [Sybase iAnywhere]" <kkhamis (AT) sybase (DOT) com>
Newsgroups: sybase.public.sqlanywhere.general
Sent: Friday, January 08, 2010 7:18 PM
Subject: Re: External procedures in x64


Quote:
Dave Foulkes wrote:
I've been experimenting with the x64 version of ASA (10.0.1.3960) and I
have been unable to execute external procedures because the server "Could
not load dynamic library XXX.dll", even though the dll is on the path.
This all works fine on the x86 version under 32bit Windows. Is there
something else I should be doing?

TIA for any illumination.

Dave.

The 64bit server will not be able to load a 32bit dll and vice versa. You
need to rebuild the dll as 64bit to use it with the 64bit server.

Karim

Reply With Quote
  #6  
Old   
Phil Mitchell [Sybase]
 
Posts: n/a

Default Re: External procedures in x64 - 01-09-2010 , 03:11 PM



32-bit processes and 64-bit processes look and act completely different
and as such 32-bit DLLs cannot be loaded into a 64-bit process (and
vice-versa).

There is officially only one thing you can do if getting your DLL
compiled to 64-bit code is not possible: run a 32-bit SA on your 64-bit
windows machine. You would lose the extra address space that 64-bit
processes give you, but not much else.

That said, I've seen this sort of thing made to "work." I haven't heard
of cases with SA, but, for example, there is a plugin for 64-bit Firefox
that allows you to load 32-bit plugins. The idea is to create a 64-bit
wrapper dll that starts the 32-bit code in a subprocess and uses
inter-process communication to pass data. A quick google search found
this page that describes the basic idea:
http://www.dnjonline.com/article.asp...n07_access3264

Again, I've never heard of somebody doing this with SA. It is *far*
easier just to recompile your DLL...unless it's completely impossible.

Another option is to try out the external environments in 11.0.0+ which
run in a separate process, so you should be able to mix 32- and 64-bit
invocations if you're careful with your environment setup. You might be
able to wrap your external function DLL in a new external environment
function to get this working.

I'm just throwing ideas out there for you. In no way have I, or anybody
else I've talked to, tried this. So, good luck.

Cheers,
Phil

On 01/09/2010 06:55 AM, Dave Foulkes wrote:
Quote:
Karim,

Thanks for your reply. I presume then that there's no simple way to wrap up
a 32bit dll for use with the 64bit ASA server - it's 64bit or nothing.

Dave.

----- Original Message ----- From: "Karim Khamis [Sybase iAnywhere]"
kkhamis (AT) sybase (DOT) com
Newsgroups: sybase.public.sqlanywhere.general
Sent: Friday, January 08, 2010 7:18 PM
Subject: Re: External procedures in x64


Dave Foulkes wrote:
I've been experimenting with the x64 version of ASA (10.0.1.3960) and
I have been unable to execute external procedures because the server
"Could not load dynamic library XXX.dll", even though the dll is on
the path. This all works fine on the x86 version under 32bit Windows.
Is there something else I should be doing?

TIA for any illumination.

Dave.

The 64bit server will not be able to load a 32bit dll and vice versa.
You need to rebuild the dll as 64bit to use it with the 64bit server.

Karim

Reply With Quote
  #7  
Old   
Dave Foulkes
 
Posts: n/a

Default Re: External procedures in x64 - 01-10-2010 , 10:45 AM



Many thanks for the full and informative response. I too found the dnjonline
article you mention, but as you observe it looks like it's less work to
start from scratch in a 64bit environment rather than fiddling about trying
to wrap the 32bit dll. Sadly, in this instance, this is not an easy course
of action either so it looks like I'll have to stay in the 32bit world a
little longer. Meanwhile I'll take a look at the external environment
function.

As an aside, the reason I was looking at the 64bit version was to see if
there was any performance advantage over the 32bit version, but without the
dll I cannot run the application at all.

Thanks again for your suggestions.

Dave.

"Phil Mitchell [Sybase]" <firstname.lastname (AT) sybase (DOT) com> wrote

Quote:
32-bit processes and 64-bit processes look and act completely different
and as such 32-bit DLLs cannot be loaded into a 64-bit process (and
vice-versa).

There is officially only one thing you can do if getting your DLL compiled
to 64-bit code is not possible: run a 32-bit SA on your 64-bit windows
machine. You would lose the extra address space that 64-bit processes
give you, but not much else.

That said, I've seen this sort of thing made to "work." I haven't heard
of cases with SA, but, for example, there is a plugin for 64-bit Firefox
that allows you to load 32-bit plugins. The idea is to create a 64-bit
wrapper dll that starts the 32-bit code in a subprocess and uses
inter-process communication to pass data. A quick google search found
this page that describes the basic idea:
http://www.dnjonline.com/article.asp...n07_access3264

Again, I've never heard of somebody doing this with SA. It is *far*
easier just to recompile your DLL...unless it's completely impossible.

Another option is to try out the external environments in 11.0.0+ which
run in a separate process, so you should be able to mix 32- and 64-bit
invocations if you're careful with your environment setup. You might be
able to wrap your external function DLL in a new external environment
function to get this working.

I'm just throwing ideas out there for you. In no way have I, or anybody
else I've talked to, tried this. So, good luck.

Cheers,
Phil

On 01/09/2010 06:55 AM, Dave Foulkes wrote:
Karim,

Thanks for your reply. I presume then that there's no simple way to wrap
up
a 32bit dll for use with the 64bit ASA server - it's 64bit or nothing.

Dave.

----- Original Message ----- From: "Karim Khamis [Sybase iAnywhere]"
kkhamis (AT) sybase (DOT) com
Newsgroups: sybase.public.sqlanywhere.general
Sent: Friday, January 08, 2010 7:18 PM
Subject: Re: External procedures in x64


Dave Foulkes wrote:
I've been experimenting with the x64 version of ASA (10.0.1.3960) and
I have been unable to execute external procedures because the server
"Could not load dynamic library XXX.dll", even though the dll is on
the path. This all works fine on the x86 version under 32bit Windows.
Is there something else I should be doing?

TIA for any illumination.

Dave.

The 64bit server will not be able to load a 32bit dll and vice versa.
You need to rebuild the dll as 64bit to use it with the 64bit server.

Karim

Reply With Quote
  #8  
Old   
Karim Khamis [Sybase iAnywhere]
 
Posts: n/a

Default Re: External procedures in x64 - 01-11-2010 , 08:20 AM



Dave,

If you can do it, upgrade to SA 11.0.1. The external environments in SA
11.0.0 and up support the existing C external function api and you can
mix and match 32 bit dlls with 64 bit servers AND vice versa. Changing
your existing external function declarations to external environment
declarations is trivial since you only need to add one of the C_ODBC32,
C_ODBC64, C_ESQL32 or C_ESQL64 language types. Once you do that, your
dlls will load in an external environment and will get invoked in
exactly the same manner as they currently do within the server. One note
though, because the external environments are in a separate process,
external environment calls are much slower than in process external
function calls. As a result, if performance is the overriding factor,
then your best course of action is to see if you can recompile your dll
for 64-bit.

Karim
Dave Foulkes wrote:
Quote:
Many thanks for the full and informative response. I too found the
dnjonline article you mention, but as you observe it looks like it's
less work to start from scratch in a 64bit environment rather than
fiddling about trying to wrap the 32bit dll. Sadly, in this instance,
this is not an easy course of action either so it looks like I'll have
to stay in the 32bit world a little longer. Meanwhile I'll take a look
at the external environment function.

As an aside, the reason I was looking at the 64bit version was to see if
there was any performance advantage over the 32bit version, but without
the dll I cannot run the application at all.

Thanks again for your suggestions.

Dave.

"Phil Mitchell [Sybase]" <firstname.lastname (AT) sybase (DOT) com> wrote in
message news:4b48f106$1 (AT) forums-1-dub (DOT) ..
32-bit processes and 64-bit processes look and act completely
different and as such 32-bit DLLs cannot be loaded into a 64-bit
process (and vice-versa).

There is officially only one thing you can do if getting your DLL
compiled to 64-bit code is not possible: run a 32-bit SA on your
64-bit windows machine. You would lose the extra address space that
64-bit processes give you, but not much else.

That said, I've seen this sort of thing made to "work." I haven't
heard of cases with SA, but, for example, there is a plugin for 64-bit
Firefox that allows you to load 32-bit plugins. The idea is to create
a 64-bit wrapper dll that starts the 32-bit code in a subprocess and
uses inter-process communication to pass data. A quick google search
found this page that describes the basic idea:
http://www.dnjonline.com/article.asp...n07_access3264

Again, I've never heard of somebody doing this with SA. It is *far*
easier just to recompile your DLL...unless it's completely impossible.

Another option is to try out the external environments in 11.0.0+
which run in a separate process, so you should be able to mix 32- and
64-bit invocations if you're careful with your environment setup. You
might be able to wrap your external function DLL in a new external
environment function to get this working.

I'm just throwing ideas out there for you. In no way have I, or
anybody else I've talked to, tried this. So, good luck.

Cheers,
Phil

On 01/09/2010 06:55 AM, Dave Foulkes wrote:
Karim,

Thanks for your reply. I presume then that there's no simple way to
wrap up
a 32bit dll for use with the 64bit ASA server - it's 64bit or nothing.

Dave.

----- Original Message ----- From: "Karim Khamis [Sybase iAnywhere]"
kkhamis (AT) sybase (DOT) com
Newsgroups: sybase.public.sqlanywhere.general
Sent: Friday, January 08, 2010 7:18 PM
Subject: Re: External procedures in x64


Dave Foulkes wrote:
I've been experimenting with the x64 version of ASA (10.0.1.3960) and
I have been unable to execute external procedures because the server
"Could not load dynamic library XXX.dll", even though the dll is on
the path. This all works fine on the x86 version under 32bit Windows.
Is there something else I should be doing?

TIA for any illumination.

Dave.

The 64bit server will not be able to load a 32bit dll and vice versa.
You need to rebuild the dll as 64bit to use it with the 64bit server.

Karim


Reply With Quote
  #9  
Old   
Dave Foulkes
 
Posts: n/a

Default Re: External procedures in x64 - 01-11-2010 , 08:40 AM



Karim,

Thank you for the suggestion - I can try 11.0.1, and I do like the sound of
"trivial". Ironically, for the test I have in mind, only a few of the
functions in the dll are actually required and even they are not called
frequently. Maybe I can take a peek into the 64bit world a little more
easily than I'd hitherto thought.

Dave.

"Karim Khamis [Sybase iAnywhere]" <kkhamis (AT) sybase (DOT) com> wrote

Quote:
Dave,

If you can do it, upgrade to SA 11.0.1. The external environments in SA
11.0.0 and up support the existing C external function api and you can mix
and match 32 bit dlls with 64 bit servers AND vice versa. Changing your
existing external function declarations to external environment
declarations is trivial since you only need to add one of the C_ODBC32,
C_ODBC64, C_ESQL32 or C_ESQL64 language types. Once you do that, your dlls
will load in an external environment and will get invoked in exactly the
same manner as they currently do within the server. One note though,
because the external environments are in a separate process, external
environment calls are much slower than in process external function calls.
As a result, if performance is the overriding factor, then your best
course of action is to see if you can recompile your dll for 64-bit.

Karim
Dave Foulkes wrote:
Many thanks for the full and informative response. I too found the
dnjonline article you mention, but as you observe it looks like it's less
work to start from scratch in a 64bit environment rather than fiddling
about trying to wrap the 32bit dll. Sadly, in this instance, this is not
an easy course of action either so it looks like I'll have to stay in the
32bit world a little longer. Meanwhile I'll take a look at the external
environment function.

As an aside, the reason I was looking at the 64bit version was to see if
there was any performance advantage over the 32bit version, but without
the dll I cannot run the application at all.

Thanks again for your suggestions.

Dave.

"Phil Mitchell [Sybase]" <firstname.lastname (AT) sybase (DOT) com> wrote in message
news:4b48f106$1 (AT) forums-1-dub (DOT) ..
32-bit processes and 64-bit processes look and act completely different
and as such 32-bit DLLs cannot be loaded into a 64-bit process (and
vice-versa).

There is officially only one thing you can do if getting your DLL
compiled to 64-bit code is not possible: run a 32-bit SA on your 64-bit
windows machine. You would lose the extra address space that 64-bit
processes give you, but not much else.

That said, I've seen this sort of thing made to "work." I haven't heard
of cases with SA, but, for example, there is a plugin for 64-bit Firefox
that allows you to load 32-bit plugins. The idea is to create a 64-bit
wrapper dll that starts the 32-bit code in a subprocess and uses
inter-process communication to pass data. A quick google search found
this page that describes the basic idea:
http://www.dnjonline.com/article.asp...n07_access3264

Again, I've never heard of somebody doing this with SA. It is *far*
easier just to recompile your DLL...unless it's completely impossible.

Another option is to try out the external environments in 11.0.0+ which
run in a separate process, so you should be able to mix 32- and 64-bit
invocations if you're careful with your environment setup. You might be
able to wrap your external function DLL in a new external environment
function to get this working.

I'm just throwing ideas out there for you. In no way have I, or anybody
else I've talked to, tried this. So, good luck.

Cheers,
Phil

On 01/09/2010 06:55 AM, Dave Foulkes wrote:
Karim,

Thanks for your reply. I presume then that there's no simple way to
wrap up
a 32bit dll for use with the 64bit ASA server - it's 64bit or nothing.

Dave.

----- Original Message ----- From: "Karim Khamis [Sybase iAnywhere]"
kkhamis (AT) sybase (DOT) com
Newsgroups: sybase.public.sqlanywhere.general
Sent: Friday, January 08, 2010 7:18 PM
Subject: Re: External procedures in x64


Dave Foulkes wrote:
I've been experimenting with the x64 version of ASA (10.0.1.3960) and
I have been unable to execute external procedures because the server
"Could not load dynamic library XXX.dll", even though the dll is on
the path. This all works fine on the x86 version under 32bit Windows.
Is there something else I should be doing?

TIA for any illumination.

Dave.

The 64bit server will not be able to load a 32bit dll and vice versa.
You need to rebuild the dll as 64bit to use it with the 64bit server.

Karim


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.