473,769 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

cfront.dll wrapping in c++

I have unsuccessfully searched back and forth for a solution to the
following problem. I hope someone out there can help me.

I have created a C++ .NET wrapper for a 3-rd party C based DLL
(cfront.dll from Navision) but the wrapper access to the DLL doesn't
work for some of the exported functions?!?

To illustrate what I mean, I have created the following small
test-case. You simply compile and link it using the cf.h and libload.c
(from Navision) unchanged. When it runs it throws the following
exception before it starts running:

An unhandled exception of type 'System.TypeLoa dException'
occurred in TestCase.exe
Additional information: Could not load type DBL_REC from assembly
TestCase, Version=1.0.141 7.19361,
Culture=neutral , PublicKeyToken= null.

However, if the "DBL_HREC hRec=..." line is commented out then it
works fine??!?

-----
#include "stdafx.h"

extern "C" {
#include "cf.h"
}

public __gc class TestClass
{
public:
void executeNavSampl e() {
SessionInit((DB L_U8 *)"cfront.dll") ;
DBL_ConnectServ erAndOpenDataba se((DBL_U8*)"nd bcn",NULL,
(DBL_U8*)"tcp", (DBL_U8*)"sampl e.fdb",
10000,1,1,0,0);
DBL_NextCompany (NULL);
DBL_HTABLE hTable;
DBL_OpenTable(& hTable,50000);
// Comment this line out and it works???!?
DBL_HREC hRec=DBL_AllocR ec(hTable);
DBL_CloseTable( hTable);
DBL_CloseCompan y();
DBL_CloseDataba se();
DBL_Exit();
}
};

int _tmain()
{
TestClass *test=new TestClass();
test->executeNavSamp le();
return 0;
}
-----

If you could give me some comments on this, it would be very helpful.
You might also be able to redirect me to somewhere or someone that
could possible help me?

If you want I could send you the Visual Studio project and you could
try it out. Just send me an e-mail. Thanks in advance and looking
forward to hearing from you.

-Alfred

PS: I compile the file from with in Visual Studio 2003 .NET and the
project is created using the C++ Console Application (.NET) project
template.

The command line arguments used when compiling are: /Od /AI "H:\Visual
Studio Projects\WSTest \Debug" /D "WIN32" /D "_DEBUG" /D "_MBCS" /FD
/EHsc /MTd /GS /Yu"stdafx.h" /Fp"Debug/DirectNavDotNet .pch"
/Fo"Debug/" /Fd"Debug/vc70.pdb" /W3 /nologo /c /Zi /clr /TP /FU
"C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \mscorlib.dll" /FU
"C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.dll" /FU
"C:\WINDOWS\Mic rosoft.NET\Fram ework\v1.1.4322 \System.Data.dl l"

The command line arguments used when linking are: /OUT:"H:\Visual
Studio Projects\WSTest \Debug\DirectNa vDotNet.exe" /INCREMENTAL /NOLOGO
/DEBUG /ASSEMBLYDEBUG /PDB:"H:\Visual Studio
Projects\WSTest \Debug/DirectNavDotNet .pdb" /FIXED:No kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
Nov 16 '05 #1
0 1571

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

Similar topics

10
503
by: Rohit Upadhyay HCST | last post by:
Hi !!! I wanted to migrate to c++, But Im in no hurry so I actually want to see how the C++ calls get translated into C, using Cfront(the original thing that Bjourne developed). But I cant find any place to download it from ? Any links,resources ?
1
2052
by: Wormald | last post by:
I am trying to recreate a legacy 68K Apollo development environment on Windows. (Nearly there excpet for the CFRONT). We are currently outsourcing this work but would ideally like to bring it inhouse. All I need now is a CFRONT Compiler to translate C++ source to C source. Our old Apollo's are gone, and need to replace with an equivalent Microsft based Compiler/translator.
16
2742
by: Bunny.Joy | last post by:
Hi, I know that some granddaddy-level C++ compiler can compile C++ code into a C intermediate. Apart from that, however, I can not find any modern compiler to do that. And in fact, I think, this factor is very pragmatical for a C programmer to learn Java more effectively. Any one can give me some information on that ? Tools, compilers or other methods applicable are all attractive to me. But where to get them?
2
2785
by: napi | last post by:
I managed to compile CFront 3.03 on my Ubuntu Linux kernel 2.6.20-15. I compiled CFront with g++ version 4.1.2 and used bison 2.3 to process the gram.y file. When I compiled this program using "CC -F hello.C": --------------------------------------- hello.C------------------------------------------------- struct y { int p;
1
2271
by: napi | last post by:
Does anyone know of any public domain C++ compiler that uses CFront as its front end? If you do would appreciate the links or other related info. p.s. Info on any commercial C++ compiler that uses CFront is fine too. Thanks. Napi http://www.softwarepreservation.org/projects/c_plus_plus/index.html#cfront
5
1996
by: JohnQ | last post by:
What is the status of cfront in regards to copyright and licensing? The source code is available on the web in at least one location (should it be?). John
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9420
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
10035
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
9851
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5293
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...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3949
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
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
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.