473,804 Members | 3,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling C DLL in Web Service using LoadLibrary/GetProcAddress?

I have some C functions I need to expose as XML web services. My original
plan was to deply an XML Web service in C# or VB and use P/Invoke to call my
C functions. This is not working because the web service cannot find the DLL
in the same directory.

This is probably because the DLL needs to be in a different directory,
perhaps the same directory as ASP.NET or \WinNT\System32 . Unfortunately,
placing my DLL in these directories is not an option because I'm using a
hosting service.

Since I'm not getting any response from my queries in the WebServices forum
I guess I need to take another approach.

I know how to explicitly specify the full path of a DLL when calling
LoadLibrary/GetProcAddress when using C++. Is it possible to call my C
functions in their DLL using VB with LoadLibrary/GetProcAddress? What does
GetProcAddress return, a delegate? How does VB.NET deal with function
pointers? Does anyone have some sample code where VB.NET uses
LoadLibrary/GetProcAddess?

Siegfried
Nov 20 '05 #1
1 10196
check here

http://www.codeproject.com/csharp/dyninvok.asp

Cheers,

Greg

"Siegfried Heintze" <si*******@hein tze.com> wrote in message
news:uT******** ******@TK2MSFTN GP09.phx.gbl...
I have some C functions I need to expose as XML web services. My original
plan was to deply an XML Web service in C# or VB and use P/Invoke to call my C functions. This is not working because the web service cannot find the DLL in the same directory.

This is probably because the DLL needs to be in a different directory,
perhaps the same directory as ASP.NET or \WinNT\System32 . Unfortunately,
placing my DLL in these directories is not an option because I'm using a
hosting service.

Since I'm not getting any response from my queries in the WebServices forum I guess I need to take another approach.

I know how to explicitly specify the full path of a DLL when calling
LoadLibrary/GetProcAddress when using C++. Is it possible to call my C
functions in their DLL using VB with LoadLibrary/GetProcAddress? What does
GetProcAddress return, a delegate? How does VB.NET deal with function
pointers? Does anyone have some sample code where VB.NET uses
LoadLibrary/GetProcAddess?

Siegfried

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1505
by: bclegg | last post by:
Hi, I have to use a 3rd party C++ DLL say (3PDLL) It comes with a header file that declares its interface. The interface is a structure say (3PStruct) that has a member for each exposed function. We (not I)have made a C++ dll say (MyInterface)that attaches to this DLL and exposes its public functions. MyInterface is then used by the main VB app.
8
3627
by: one2001boy | last post by:
Hello, I can use call a function with any arugment from LoadLibrary(), but not a function with argument of "FILE*. For example, I can build a .DLL dynamically loaded library with option /DDD in VC++ in command link.exe. This dynamically loaded library can then be loaded by function LoadLibrary(). The address of a function say func1(int) inside .DLL file can be exported and accessed by function
8
21254
by: ATS | last post by:
HOWTO Implement LoadLibrary\GetProcAdrress\FreeLibrary in C# Please help, I want to fully implement LoadLibrary\GetProcAdrress\FreeLibrary in C#, and be able to call functions that I use GetProcAddress on to pass info to non-.NET apps. I can not use the standard "interop" process, as the DLL's are created dynamically. I need this: ========================================
3
1901
by: AK | last post by:
I'm using a .NET Windows Forms Applications project. I'm using LoadLibrary & GetProcAddress to use a DLL function. This is all done in the main cpp file. I would like to use this DLL function in a .h file. So I code : (Proc2) (0x378, 12)....... (where Proc2 is the function) I get a compiler error : C2065 : 'Proc2' : undeclared identifier. I'm guessing I'm not calling this function properly - how can I fix this problem ? When I write a...
46
3788
by: Usenet User | last post by:
I need to be able to call the same API function from VB, which will reside in different DLLs. While all of the functions have the same signature and name, DLL file names are not known at compile time. Therefore, my assumption that using Declare statement or DllImport attribute is NOT an option in such a case. I can use LoadLibrary() and GetProcAddress() from Kernel32 to get the addreses, but is there a way to actually call an API method...
3
5271
by: Beorne | last post by:
I have a propertary library dll (used to drive a device) that I call from my C# code. Calling the functions from C++ is really faster than calling them in C+ +. From C++ the call is almost instantaneous, from C# is about 1.5 seconds long. For example, this command powers a device based on an interface switch and returns a message in Ack_Msg that is len long. Besides returns an error code.
1
2716
by: Terry Olsen | last post by:
I'm using the SciLexer.dll to write a code editor for an in-house scripting language. I have the editor window up on a form but I need to use it's API. I've used the following commands to load the dll: Private scihWnd As Integer 'Scintilla's hWnd Private SciFunc As Integer 'Scintilla's Main Function Call Private sciptr As Integer 'Scintilla's Direct Pointer Private scihmod As Integer 'Scintilla's hMod scihmod =...
0
2521
by: Markus Eßmayr | last post by:
Hello! I'm writing a .NET component that forwards calls to it's functions on to an unmanaged DLL. This DLL is loaded dynamically using LoadLibrary and the function pointers are retrieved using GetProcAddress. The "references" to the unmanaged DLL are held inside my ref class. See this example:
8
4344
by: Ryanivanka | last post by:
hi ,everyone ,please check my codes,i am really confused. the codes of win32 dll is as follows: ***********************the win32 DLL writen in c++***************** extern "C" { __declspec(dllexport) WCHAR* __stdcall getWNameOfComponnet();
0
9572
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7608
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5508
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4282
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2978
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.