473,395 Members | 1,653 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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.TypeLoadException'
occurred in TestCase.exe
Additional information: Could not load type DBL_REC from assembly
TestCase, Version=1.0.1417.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 executeNavSample() {
SessionInit((DBL_U8 *)"cfront.dll");
DBL_ConnectServerAndOpenDatabase((DBL_U8*)"ndbcn", NULL,
(DBL_U8*)"tcp",(DBL_U8*)"sample.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_AllocRec(hTable);
DBL_CloseTable(hTable);
DBL_CloseCompany();
DBL_CloseDatabase();
DBL_Exit();
}
};

int _tmain()
{
TestClass *test=new TestClass();
test->executeNavSample();
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\Microsoft.NET\Framework\v1.1.4322\msco rlib.dll" /FU
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Syst em.dll" /FU
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Syst em.Data.dll"

The command line arguments used when linking are: /OUT:"H:\Visual
Studio Projects\WSTest\Debug\DirectNavDotNet.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 1533

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

Similar topics

10
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...
1
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...
16
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...
2
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...
1
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...
5
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.